mirror of
https://github.com/actions/setup-java.git
synced 2025-06-28 12:04:14 +00:00
error handling
This commit is contained in:
parent
f4f1212c88
commit
46a44325a7
2 changed files with 84 additions and 16 deletions
45
dist/setup/index.js
vendored
45
dist/setup/index.js
vendored
|
@ -128793,15 +128793,44 @@ class JavaBase {
|
|||
}
|
||||
else {
|
||||
core.info('Trying to resolve the latest version from remote');
|
||||
const javaRelease = yield this.findPackageForDownload(this.version);
|
||||
core.info(`Resolved latest version as ${javaRelease.version}`);
|
||||
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
|
||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||
try {
|
||||
const javaRelease = yield this.findPackageForDownload(this.version);
|
||||
core.info(`Resolved latest version as ${javaRelease.version}`);
|
||||
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
|
||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.info('Trying to download...');
|
||||
foundJava = yield this.downloadTool(javaRelease);
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
catch (resolveError) {
|
||||
if (resolveError instanceof tc.HTTPError &&
|
||||
resolveError.httpStatusCode === 403) {
|
||||
core.error(`Received HTTP 403: Permission denied or restricted access.`);
|
||||
}
|
||||
else if (resolveError instanceof tc.HTTPError &&
|
||||
resolveError.httpStatusCode === 429) {
|
||||
core.warning(`Received HTTP 429: Rate limit exceeded. Try again later.`);
|
||||
}
|
||||
else {
|
||||
const message = resolveError instanceof Error
|
||||
? resolveError.message
|
||||
: JSON.stringify(resolveError);
|
||||
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);
|
||||
}
|
||||
throw resolveError;
|
||||
}
|
||||
}
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue