Skip to content
Merged
Prev Previous commit
Next Next commit
fix(graalvm): enhance error messages for version not found scenarios
  • Loading branch information
chiranjib-swain committed Mar 27, 2026
commit 8c15982abcc6d5f8dc49e6699f5766d0c59be15d
4 changes: 3 additions & 1 deletion __tests__/distributors/graalvm-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ describe('GraalVMDistribution', () => {
// Verify the error is thrown with the expected message
await expect(
(distribution as any).findPackageForDownload('17.0.99')
).rejects.toThrow("No matching version found for SemVer '17.0.99'");
).rejects.toThrow(
"No matching GraalVM version found for SemVer '17.0.99'. Available versions can be found at https://download.oracle.com/graalvm/. Pick a version from the list."
);

// Verify the hint about checking the base URL is included
await expect(
Expand Down
7 changes: 3 additions & 4 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113217,10 +113217,9 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
handleHttpResponse(response, range) {
const statusCode = response.message.statusCode;
if (statusCode === http_client_1.HttpCodes.NotFound) {
// Create the standard error with additional hint about checking the download URL
const error = this.createVersionNotFoundError(range);
error.message += `\nPlease check if this version is available at ${GRAALVM_DL_BASE}`;
throw error;
throw new Error(`No matching GraalVM version found for SemVer '${range}'.` +
` Available versions can be found at ${GRAALVM_DL_BASE}/.` +
` Pick a version from the list.`);
}
if (statusCode === http_client_1.HttpCodes.Unauthorized ||
statusCode === http_client_1.HttpCodes.Forbidden) {
Expand Down
9 changes: 5 additions & 4 deletions src/distributions/graalvm/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ export class GraalVMDistribution extends JavaBase {
const statusCode = response.message.statusCode;

if (statusCode === HttpCodes.NotFound) {
// Create the standard error with additional hint about checking the download URL
const error = this.createVersionNotFoundError(range);
error.message += `\nPlease check if this version is available at ${GRAALVM_DL_BASE}`;
throw error;
throw new Error(
`No matching GraalVM version found for SemVer '${range}'.` +
` Available versions can be found at ${GRAALVM_DL_BASE}/.` +
` Pick a version from the list.`
);
}

if (
Expand Down
Loading