mirror of
https://github.com/actions/setup-java.git
synced 2026-03-24 12:30:21 +00:00
fix(graalvm): improve error messages for EA version not found scenarios
This commit is contained in:
parent
96e5c4f511
commit
102c2095e0
@ -508,7 +508,7 @@ describe('GraalVMDistribution', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('23')
|
(distribution as any).findPackageForDownload('23')
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
"Could not find satisfied version for SemVer '23-ea'"
|
"No EA build is marked as 'latest' for version range '23-ea'. Available EA versions: 23-ea-20240716."
|
||||||
);
|
);
|
||||||
|
|
||||||
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
||||||
@ -718,7 +718,9 @@ describe('GraalVMDistribution', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
).rejects.toThrow("Could not find satisfied version for SemVer '23-ea'");
|
).rejects.toThrow(
|
||||||
|
"No EA build is marked as 'latest' for version range '23-ea'. Available EA versions: 23-ea-20240716, 23-ea-20240709."
|
||||||
|
);
|
||||||
|
|
||||||
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
||||||
});
|
});
|
||||||
|
|||||||
8
dist/setup/index.js
vendored
8
dist/setup/index.js
vendored
@ -112584,7 +112584,7 @@ class JavaBase {
|
|||||||
const maxVersionsToShow = core.isDebug() ? availableVersions.length : 50;
|
const maxVersionsToShow = core.isDebug() ? availableVersions.length : 50;
|
||||||
const versionsToShow = availableVersions.slice(0, maxVersionsToShow);
|
const versionsToShow = availableVersions.slice(0, maxVersionsToShow);
|
||||||
const truncated = availableVersions.length > maxVersionsToShow;
|
const truncated = availableVersions.length > maxVersionsToShow;
|
||||||
parts.push(`Available versions: ${versionsToShow.join(', ')}${truncated ? '...' : ''}`);
|
parts.push(`Available versions: ${versionsToShow.join(', ')}${truncated ? ', ...' : ''}`);
|
||||||
if (truncated) {
|
if (truncated) {
|
||||||
parts.push(`(showing first ${maxVersionsToShow} of ${availableVersions.length} versions, enable debug mode to see all)`);
|
parts.push(`(showing first ${maxVersionsToShow} of ${availableVersions.length} versions, enable debug mode to see all)`);
|
||||||
}
|
}
|
||||||
@ -113238,7 +113238,11 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
|||||||
const latestVersion = versions.find(v => v.latest);
|
const latestVersion = versions.find(v => v.latest);
|
||||||
if (!latestVersion) {
|
if (!latestVersion) {
|
||||||
const availableVersions = versions.map(v => v.version);
|
const availableVersions = versions.map(v => v.version);
|
||||||
throw this.createVersionNotFoundError(javaEaVersion, availableVersions);
|
let message = `No EA build is marked as 'latest' for version range '${javaEaVersion}'.`;
|
||||||
|
if (availableVersions.length > 0) {
|
||||||
|
message += ` Available EA versions: ${availableVersions.join(', ')}.`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||||
const arch = this.distributionArchitecture();
|
const arch = this.distributionArchitecture();
|
||||||
|
|||||||
@ -282,7 +282,7 @@ export abstract class JavaBase {
|
|||||||
const truncated = availableVersions.length > maxVersionsToShow;
|
const truncated = availableVersions.length > maxVersionsToShow;
|
||||||
|
|
||||||
parts.push(
|
parts.push(
|
||||||
`Available versions: ${versionsToShow.join(', ')}${truncated ? '...' : ''}`
|
`Available versions: ${versionsToShow.join(', ')}${truncated ? ', ...' : ''}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (truncated) {
|
if (truncated) {
|
||||||
|
|||||||
@ -182,7 +182,11 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
const latestVersion = versions.find(v => v.latest);
|
const latestVersion = versions.find(v => v.latest);
|
||||||
if (!latestVersion) {
|
if (!latestVersion) {
|
||||||
const availableVersions = versions.map(v => v.version);
|
const availableVersions = versions.map(v => v.version);
|
||||||
throw this.createVersionNotFoundError(javaEaVersion, availableVersions);
|
let message = `No EA build is marked as 'latest' for version range '${javaEaVersion}'.`;
|
||||||
|
if (availableVersions.length > 0) {
|
||||||
|
message += ` Available EA versions: ${availableVersions.join(', ')}.`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user