Better error for 404
This commit is contained in:
+13
-3
@@ -65026,7 +65026,17 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
|
|||||||
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
||||||
const url = getDownloadURL(platform, engine, version)
|
const url = getDownloadURL(platform, engine, version)
|
||||||
console.log(url)
|
console.log(url)
|
||||||
return await tc.downloadTool(url)
|
try {
|
||||||
|
return await tc.downloadTool(url)
|
||||||
|
} catch (error) {
|
||||||
|
if (error.message.endsWith('404')) {
|
||||||
|
throw new Error(`Unavailable version ${version} for ${engine} on ${platform}.
|
||||||
|
You can request it at https://github.com/ruby/setup-ruby/issues.
|
||||||
|
Original Error: (${error.message})`)
|
||||||
|
} else {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await common.measure('Extracting Ruby', async () => {
|
await common.measure('Extracting Ruby', async () => {
|
||||||
@@ -65889,8 +65899,8 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVe
|
|||||||
if (found) {
|
if (found) {
|
||||||
version = found
|
version = found
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unknown version ${parsedVersion} for ${engine} on ${platform}
|
throw new Error(`Unknown version ${parsedVersion} for ${engine} on ${platform}.
|
||||||
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}
|
Available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}.
|
||||||
Make sure you use the latest version of the action with - uses: ruby/setup-ruby@v1`)
|
Make sure you use the latest version of the action with - uses: ruby/setup-ruby@v1`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVe
|
|||||||
if (found) {
|
if (found) {
|
||||||
version = found
|
version = found
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unknown version ${parsedVersion} for ${engine} on ${platform}
|
throw new Error(`Unknown version ${parsedVersion} for ${engine} on ${platform}.
|
||||||
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}
|
Available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}.
|
||||||
Make sure you use the latest version of the action with - uses: ruby/setup-ruby@v1`)
|
Make sure you use the latest version of the action with - uses: ruby/setup-ruby@v1`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-1
@@ -69,7 +69,17 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
|
|||||||
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
||||||
const url = getDownloadURL(platform, engine, version)
|
const url = getDownloadURL(platform, engine, version)
|
||||||
console.log(url)
|
console.log(url)
|
||||||
return await tc.downloadTool(url)
|
try {
|
||||||
|
return await tc.downloadTool(url)
|
||||||
|
} catch (error) {
|
||||||
|
if (error.message.endsWith('404')) {
|
||||||
|
throw new Error(`Unavailable version ${version} for ${engine} on ${platform}.
|
||||||
|
You can request it at https://github.com/ruby/setup-ruby/issues.
|
||||||
|
Original Error: (${error.message})`)
|
||||||
|
} else {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await common.measure('Extracting Ruby', async () => {
|
await common.measure('Extracting Ruby', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user