mirror of
				https://github.com/actions/setup-node.git
				synced 2025-10-31 16:14:00 +08:00 
			
		
		
		
	refactor: remove locally caught exceptions
This commit is contained in:
		| @@ -506,18 +506,14 @@ export function parseNodeVersionFile(contents: string): string { | ||||
|   } | ||||
|  | ||||
|   if (!nodeVersion) { | ||||
|     try { | ||||
|       const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); | ||||
|       nodeVersion = found?.groups?.version; | ||||
|  | ||||
|       if (!nodeVersion) throw new Error(); | ||||
|     } catch (err) { | ||||
|       // In the case of an unknown format, | ||||
|       // return as is and evaluate the version separately. | ||||
|       nodeVersion = contents.trim(); | ||||
|     } | ||||
|     const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); | ||||
|     nodeVersion = found?.groups?.version; | ||||
|   } | ||||
|  | ||||
|   // In the case of an unknown format, | ||||
|   // return as is and evaluate the version separately. | ||||
|   if (!nodeVersion) nodeVersion = contents.trim(); | ||||
|  | ||||
|   return nodeVersion as string; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jef LeCompte
					Jef LeCompte