mirror of
https://github.com/actions/setup-java.git
synced 2025-06-08 10:21:21 +00:00
commit
This commit is contained in:
parent
46a44325a7
commit
8be1e72903
26
dist/setup/index.js
vendored
26
dist/setup/index.js
vendored
@ -128801,36 +128801,26 @@ class JavaBase {
|
||||
}
|
||||
else {
|
||||
core.info('Trying to download...');
|
||||
try {
|
||||
foundJava = yield this.downloadTool(javaRelease);
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
}
|
||||
catch (downloadError) {
|
||||
core.error('Failed to download Java. Please check your network connection or the provided version.');
|
||||
core.error(`Error details: ${downloadError.message}`);
|
||||
throw downloadError;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (resolveError) {
|
||||
if (resolveError instanceof tc.HTTPError &&
|
||||
resolveError.httpStatusCode === 403) {
|
||||
catch (error) {
|
||||
if (error instanceof tc.HTTPError && error.httpStatusCode === 403) {
|
||||
core.error(`Received HTTP 403: Permission denied or restricted access.`);
|
||||
}
|
||||
else if (resolveError instanceof tc.HTTPError &&
|
||||
resolveError.httpStatusCode === 429) {
|
||||
else if (error instanceof tc.HTTPError &&
|
||||
error.httpStatusCode === 429) {
|
||||
core.warning(`Received HTTP 429: Rate limit exceeded. Try again later.`);
|
||||
}
|
||||
else {
|
||||
const message = resolveError instanceof Error
|
||||
? resolveError.message
|
||||
: JSON.stringify(resolveError);
|
||||
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
||||
core.error(`Failed to set up Java due to a network issue or timeout: ${message}`);
|
||||
}
|
||||
if (resolveError instanceof Error && resolveError.stack) {
|
||||
core.debug(resolveError.stack);
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
throw resolveError;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
|
@ -58,46 +58,33 @@ export abstract class JavaBase {
|
||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||
} else {
|
||||
core.info('Trying to download...');
|
||||
try {
|
||||
foundJava = await this.downloadTool(javaRelease);
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
} catch (downloadError: any) {
|
||||
core.error(
|
||||
'Failed to download Java. Please check your network connection or the provided version.'
|
||||
);
|
||||
core.error(`Error details: ${downloadError.message}`);
|
||||
throw downloadError;
|
||||
}
|
||||
}
|
||||
} catch (resolveError: any) {
|
||||
if (
|
||||
resolveError instanceof tc.HTTPError &&
|
||||
resolveError.httpStatusCode === 403
|
||||
) {
|
||||
} catch (error: any) {
|
||||
if (error instanceof tc.HTTPError && error.httpStatusCode === 403) {
|
||||
core.error(
|
||||
`Received HTTP 403: Permission denied or restricted access.`
|
||||
);
|
||||
} else if (
|
||||
resolveError instanceof tc.HTTPError &&
|
||||
resolveError.httpStatusCode === 429
|
||||
error instanceof tc.HTTPError &&
|
||||
error.httpStatusCode === 429
|
||||
) {
|
||||
core.warning(
|
||||
`Received HTTP 429: Rate limit exceeded. Try again later.`
|
||||
);
|
||||
} else {
|
||||
const message =
|
||||
resolveError instanceof Error
|
||||
? resolveError.message
|
||||
: JSON.stringify(resolveError);
|
||||
error instanceof Error ? error.message : JSON.stringify(error);
|
||||
core.error(
|
||||
`Failed to set up Java due to a network issue or timeout: ${message}`
|
||||
);
|
||||
}
|
||||
if (resolveError instanceof Error && resolveError.stack) {
|
||||
core.debug(resolveError.stack);
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
|
||||
throw resolveError;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user