Skip to content

Commit 8e04ddf

Browse files
Update Error Messages and Fix Architecture Detection for IBM Semeru (#677)
* Updated Error message for Semuru * Enhanced error message * Added architecture to semeru * updated code to provide aarch64 for arm64 architecture for semeru * updated semver message * updated semver error message * Enhanced the error message for semeru * Enhanced error messaged for semeru distribution * enhanced error message for semeru
1 parent 67fbd72 commit 8e04ddf

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

__tests__/distributors/semeru-installer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ describe('findPackageForDownload', () => {
207207
});
208208
distribution['getAvailableVersions'] = async () => [];
209209
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
210-
`Unsupported architecture for IBM Semeru: ${arch}, the following are supported: x64, x86, ppc64le, ppc64, s390x, aarch64`
210+
`Unsupported architecture for IBM Semeru: ${arch} for your current OS version, the following are supported: x64, x86, ppc64le, ppc64, s390x, aarch64`
211211
);
212212
}
213213
);

dist/setup/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124939,8 +124939,9 @@ class SemeruDistribution extends base_installer_1.JavaBase {
124939124939
}
124940124940
findPackageForDownload(version) {
124941124941
return __awaiter(this, void 0, void 0, function* () {
124942-
if (!supportedArchitectures.includes(this.architecture)) {
124943-
throw new Error(`Unsupported architecture for IBM Semeru: ${this.architecture}, the following are supported: ${supportedArchitectures.join(', ')}`);
124942+
const arch = this.distributionArchitecture();
124943+
if (!supportedArchitectures.includes(arch)) {
124944+
throw new Error(`Unsupported architecture for IBM Semeru: ${this.architecture} for your current OS version, the following are supported: ${supportedArchitectures.join(', ')}`);
124944124945
}
124945124946
if (!this.stable) {
124946124947
throw new Error('IBM Semeru does not provide builds for early access versions');
@@ -124974,7 +124975,7 @@ class SemeruDistribution extends base_installer_1.JavaBase {
124974124975
const availableOptionsMessage = availableOptions
124975124976
? `\nAvailable versions: ${availableOptions}`
124976124977
: '';
124977-
throw new Error(`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`);
124978+
throw new Error(`Could not find satisfied version for SemVer version '${version}' for your current OS version for ${this.architecture} architecture ${availableOptionsMessage}`);
124978124979
}
124979124980
return resolvedFullVersion;
124980124981
});
@@ -124999,7 +125000,7 @@ class SemeruDistribution extends base_installer_1.JavaBase {
124999125000
getAvailableVersions() {
125000125001
return __awaiter(this, void 0, void 0, function* () {
125001125002
const platform = this.getPlatformOption();
125002-
const arch = this.architecture;
125003+
const arch = this.distributionArchitecture();
125003125004
const imageType = this.packageType;
125004125005
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
125005125006
const releaseType = this.stable ? 'ga' : 'ea';
@@ -127946,4 +127947,4 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
127946127947
/******/ module.exports = __webpack_exports__;
127947127948
/******/
127948127949
/******/ })()
127949-
;
127950+
;

src/distributions/semeru/installer.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@ export class SemeruDistribution extends JavaBase {
3333
protected async findPackageForDownload(
3434
version: string
3535
): Promise<JavaDownloadRelease> {
36-
if (!supportedArchitectures.includes(this.architecture)) {
36+
const arch = this.distributionArchitecture();
37+
38+
if (!supportedArchitectures.includes(arch)) {
3739
throw new Error(
3840
`Unsupported architecture for IBM Semeru: ${
3941
this.architecture
40-
}, the following are supported: ${supportedArchitectures.join(', ')}`
42+
} for your current OS version, the following are supported: ${supportedArchitectures.join(
43+
', '
44+
)}`
4145
);
4246
}
4347

@@ -81,7 +85,7 @@ export class SemeruDistribution extends JavaBase {
8185
? `\nAvailable versions: ${availableOptions}`
8286
: '';
8387
throw new Error(
84-
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
88+
`Could not find satisfied version for SemVer version '${version}' for your current OS version for ${this.architecture} architecture ${availableOptionsMessage}`
8589
);
8690
}
8791

@@ -124,7 +128,7 @@ export class SemeruDistribution extends JavaBase {
124128

125129
public async getAvailableVersions(): Promise<ISemeruAvailableVersions[]> {
126130
const platform = this.getPlatformOption();
127-
const arch = this.architecture;
131+
const arch = this.distributionArchitecture();
128132
const imageType = this.packageType;
129133
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
130134
const releaseType = this.stable ? 'ga' : 'ea';

0 commit comments

Comments
 (0)