mirror of
https://github.com/actions/setup-python.git
synced 2025-04-21 17:23:52 +00:00
update the error message
This commit is contained in:
parent
1795a82047
commit
93e3e02877
21
dist/setup/index.js
vendored
21
dist/setup/index.js
vendored
@ -97562,21 +97562,20 @@ function installCpythonFromRelease(release) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
if (err instanceof tc.HTTPError) {
|
if (err instanceof tc.HTTPError) {
|
||||||
const statusCode = err.httpStatusCode;
|
const statusCode = err.httpStatusCode;
|
||||||
if (statusCode === 403 || statusCode === 429) {
|
if (statusCode === 429) {
|
||||||
const rateLimitMessage = `HTTP ${statusCode} - Rate limit likely exceeded. This is typically due to too many requests or insufficient permissions.`;
|
// Too Many Requests - usually temporary and can be retried
|
||||||
core.info(rateLimitMessage);
|
core.info(`Received HTTP status code ${statusCode}. This usually indicates the rate limit has been exceeded. Consider retrying after some time.`);
|
||||||
if (err.stack) {
|
|
||||||
core.debug(err.stack);
|
|
||||||
}
|
}
|
||||||
throw new Error(rateLimitMessage);
|
else if (statusCode === 403) {
|
||||||
|
// Forbidden - likely a permanent issue
|
||||||
|
core.error(`Received HTTP status code ${statusCode}. Access is forbidden. Please check your credentials or permissions.`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const genericErrorMessage = `HTTP ${statusCode} - ${err.message}`;
|
// Other HTTP errors
|
||||||
core.error(genericErrorMessage);
|
core.info(`Received HTTP error ${statusCode}: ${err.message}`);
|
||||||
if (err.stack) {
|
|
||||||
core.debug(err.stack);
|
|
||||||
}
|
}
|
||||||
throw new Error(genericErrorMessage);
|
if (err.stack) {
|
||||||
|
core.debug(`Stack trace: ${err.stack}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -124,7 +124,6 @@ async function installPython(workingDirectory: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function installCpythonFromRelease(release: tc.IToolRelease) {
|
export async function installCpythonFromRelease(release: tc.IToolRelease) {
|
||||||
|
|
||||||
if (!release.files || release.files.length === 0) {
|
if (!release.files || release.files.length === 0) {
|
||||||
throw new Error('No files found in the release to download.');
|
throw new Error('No files found in the release to download.');
|
||||||
}
|
}
|
||||||
@ -147,18 +146,28 @@ export async function installCpythonFromRelease(release: tc.IToolRelease) {
|
|||||||
await installPython(pythonExtractedFolder);
|
await installPython(pythonExtractedFolder);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof tc.HTTPError) {
|
if (err instanceof tc.HTTPError) {
|
||||||
// Rate limit?
|
const statusCode = err.httpStatusCode;
|
||||||
if (err.httpStatusCode === 403 || err.httpStatusCode === 429) {
|
|
||||||
|
if (statusCode === 429) {
|
||||||
|
// Too Many Requests - usually temporary and can be retried
|
||||||
core.info(
|
core.info(
|
||||||
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
`Received HTTP status code ${statusCode}. This usually indicates the rate limit has been exceeded. Consider retrying after some time.`
|
||||||
|
);
|
||||||
|
} else if (statusCode === 403) {
|
||||||
|
// Forbidden - likely a permanent issue
|
||||||
|
core.error(
|
||||||
|
`Received HTTP status code ${statusCode}. Access is forbidden. Please check your credentials or permissions.`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
core.info(err.message);
|
// Other HTTP errors
|
||||||
|
core.info(`Received HTTP error ${statusCode}: ${err.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err.stack) {
|
if (err.stack) {
|
||||||
core.debug(err.stack);
|
core.debug(`Stack trace: ${err.stack}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user