Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update error message and improved code
  • Loading branch information
mahabaleshwars committed Apr 9, 2025
commit c1df1459aa70d9f18135a12acbda74a490600510
17 changes: 9 additions & 8 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97481,18 +97481,16 @@ function getManifest() {
repoManifest.every(isIToolRelease)) {
return repoManifest;
}
else {
throw new Error('The repository manifest is invalid or does not include any valid tool release (IToolRelease) entries.');
}
throw new Error('The repository manifest is invalid or does not include any valid tool release (IToolRelease) entries.');
}
catch (err) {
core.error('Fetching the manifest via the API failed.');
core.error('Failed to fetch the manifest from the repository API.');
if (err instanceof Error) {
core.debug(`Error message: ${err.message}`);
core.error(`Error message: ${err.message}`);
core.debug(`Error stack: ${err.stack}`);
}
else {
core.error('Error is not an instance of Error. It might be something else.');
core.error('An unexpected error occurred while fetching the manifest.');
}
}
return yield getManifestFromURL();
Expand Down Expand Up @@ -97564,8 +97562,11 @@ function installCpythonFromRelease(release) {
catch (err) {
if (err instanceof tc.HTTPError) {
// Rate limit?
if (err.httpStatusCode === 403 || err.httpStatusCode === 429) {
core.error(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
if (err.httpStatusCode === 403) {
core.error(`Received HTTP status code 403 (Forbidden). This usually indicates that the request is not authorized. Please check your credentials or permissions.`);
}
else if (err.httpStatusCode === 429) {
core.error(`Received HTTP status code 429 (Too Many Requests). This usually indicates that the rate limit has been exceeded. Please wait and try again later.`);
}
else {
core.error(err.message);
Expand Down
24 changes: 12 additions & 12 deletions src/install-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,23 @@ function isIToolRelease(obj: any): obj is IToolRelease {
export async function getManifest(): Promise<tc.IToolRelease[]> {
try {
const repoManifest = await getManifestFromRepo();

if (
Array.isArray(repoManifest) &&
repoManifest.length &&
repoManifest.every(isIToolRelease)
) {
return repoManifest;
} else {
throw new Error(
'The repository manifest is invalid or does not include any valid tool release (IToolRelease) entries.'
);
}
throw new Error(
'The repository manifest is invalid or does not include any valid tool release (IToolRelease) entries.'
);
} catch (err) {
core.error('Fetching the manifest via the API failed.');
core.error('Failed to fetch the manifest from the repository API.');
if (err instanceof Error) {
core.debug(`Error message: ${err.message}`);
core.error(`Error message: ${err.message}`);
core.debug(`Error stack: ${err.stack}`);
} else {
core.error(
'Error is not an instance of Error. It might be something else.'
);
core.error('An unexpected error occurred while fetching the manifest.');
}
}
return await getManifestFromURL();
Expand Down Expand Up @@ -153,9 +149,13 @@ export async function installCpythonFromRelease(release: tc.IToolRelease) {
} catch (err) {
if (err instanceof tc.HTTPError) {
// Rate limit?
if (err.httpStatusCode === 403 || err.httpStatusCode === 429) {
if (err.httpStatusCode === 403) {
core.error(
`Received HTTP status code 403 (Forbidden). This usually indicates that the request is not authorized. Please check your credentials or permissions.`
);
} else if (err.httpStatusCode === 429) {
core.error(
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
`Received HTTP status code 429 (Too Many Requests). This usually indicates that the rate limit has been exceeded. Please wait and try again later.`
);
} else {
core.error(err.message);
Expand Down
Loading