Skip to content

Commit 8be1e72

Browse files
author
“gowridurgad”
committed
commit
1 parent 46a4432 commit 8be1e72

File tree

2 files changed

+20
-43
lines changed

2 files changed

+20
-43
lines changed

dist/setup/index.js

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -128801,36 +128801,26 @@ class JavaBase {
128801128801
}
128802128802
else {
128803128803
core.info('Trying to download...');
128804-
try {
128805-
foundJava = yield this.downloadTool(javaRelease);
128806-
core.info(`Java ${foundJava.version} was downloaded`);
128807-
}
128808-
catch (downloadError) {
128809-
core.error('Failed to download Java. Please check your network connection or the provided version.');
128810-
core.error(`Error details: ${downloadError.message}`);
128811-
throw downloadError;
128812-
}
128804+
foundJava = yield this.downloadTool(javaRelease);
128805+
core.info(`Java ${foundJava.version} was downloaded`);
128813128806
}
128814128807
}
128815-
catch (resolveError) {
128816-
if (resolveError instanceof tc.HTTPError &&
128817-
resolveError.httpStatusCode === 403) {
128808+
catch (error) {
128809+
if (error instanceof tc.HTTPError && error.httpStatusCode === 403) {
128818128810
core.error(`Received HTTP 403: Permission denied or restricted access.`);
128819128811
}
128820-
else if (resolveError instanceof tc.HTTPError &&
128821-
resolveError.httpStatusCode === 429) {
128812+
else if (error instanceof tc.HTTPError &&
128813+
error.httpStatusCode === 429) {
128822128814
core.warning(`Received HTTP 429: Rate limit exceeded. Try again later.`);
128823128815
}
128824128816
else {
128825-
const message = resolveError instanceof Error
128826-
? resolveError.message
128827-
: JSON.stringify(resolveError);
128817+
const message = error instanceof Error ? error.message : JSON.stringify(error);
128828128818
core.error(`Failed to set up Java due to a network issue or timeout: ${message}`);
128829128819
}
128830-
if (resolveError instanceof Error && resolveError.stack) {
128831-
core.debug(resolveError.stack);
128820+
if (error instanceof Error && error.stack) {
128821+
core.debug(error.stack);
128832128822
}
128833-
throw resolveError;
128823+
throw error;
128834128824
}
128835128825
}
128836128826
// JDK folder may contain postfix "Contents/Home" on macOS

src/distributions/base-installer.ts

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,46 +58,33 @@ export abstract class JavaBase {
5858
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
5959
} else {
6060
core.info('Trying to download...');
61-
try {
62-
foundJava = await this.downloadTool(javaRelease);
63-
core.info(`Java ${foundJava.version} was downloaded`);
64-
} catch (downloadError: any) {
65-
core.error(
66-
'Failed to download Java. Please check your network connection or the provided version.'
67-
);
68-
core.error(`Error details: ${downloadError.message}`);
69-
throw downloadError;
70-
}
61+
foundJava = await this.downloadTool(javaRelease);
62+
core.info(`Java ${foundJava.version} was downloaded`);
7163
}
72-
} catch (resolveError: any) {
73-
if (
74-
resolveError instanceof tc.HTTPError &&
75-
resolveError.httpStatusCode === 403
76-
) {
64+
} catch (error: any) {
65+
if (error instanceof tc.HTTPError && error.httpStatusCode === 403) {
7766
core.error(
7867
`Received HTTP 403: Permission denied or restricted access.`
7968
);
8069
} else if (
81-
resolveError instanceof tc.HTTPError &&
82-
resolveError.httpStatusCode === 429
70+
error instanceof tc.HTTPError &&
71+
error.httpStatusCode === 429
8372
) {
8473
core.warning(
8574
`Received HTTP 429: Rate limit exceeded. Try again later.`
8675
);
8776
} else {
8877
const message =
89-
resolveError instanceof Error
90-
? resolveError.message
91-
: JSON.stringify(resolveError);
78+
error instanceof Error ? error.message : JSON.stringify(error);
9279
core.error(
9380
`Failed to set up Java due to a network issue or timeout: ${message}`
9481
);
9582
}
96-
if (resolveError instanceof Error && resolveError.stack) {
97-
core.debug(resolveError.stack);
83+
if (error instanceof Error && error.stack) {
84+
core.debug(error.stack);
9885
}
9986

100-
throw resolveError;
87+
throw error;
10188
}
10289
}
10390

0 commit comments

Comments
 (0)