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