From 7faf95d67ad924328e84b56448608e065ff155c0 Mon Sep 17 00:00:00 2001 From: Aparna Jyothi Date: Mon, 14 Apr 2025 13:12:15 +0530 Subject: [PATCH] update error to debug --- dist/setup/index.js | 17 +++++++---------- src/install-python.ts | 24 +++++++++--------------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index ce71b369..33a3e567 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -97561,21 +97561,18 @@ function installCpythonFromRelease(release) { } catch (err) { if (err instanceof tc.HTTPError) { - const statusCode = err.httpStatusCode; - if (statusCode === 429) { - // Too Many Requests - usually temporary and can be retried - core.info(`Received HTTP status code ${statusCode}. This usually indicates the rate limit has been exceeded. Consider retrying after some time.`); + // Rate limit? + 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 (statusCode === 403) { - // Forbidden - likely a permanent issue - core.error(`Received HTTP status code ${statusCode}. Access is forbidden. Please check your credentials or permissions.`); + else if (err.httpStatusCode === 429) { + core.info(`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 { - // Other HTTP errors - core.info(`Received HTTP error ${statusCode}: ${err.message}`); + core.info(err.message); } if (err.stack) { - core.debug(`Stack trace: ${err.stack}`); + core.debug(err.stack); } } throw err; diff --git a/src/install-python.ts b/src/install-python.ts index ab3b2096..34a4b026 100644 --- a/src/install-python.ts +++ b/src/install-python.ts @@ -146,28 +146,22 @@ export async function installCpythonFromRelease(release: tc.IToolRelease) { await installPython(pythonExtractedFolder); } catch (err) { if (err instanceof tc.HTTPError) { - const statusCode = err.httpStatusCode; - - if (statusCode === 429) { - // Too Many Requests - usually temporary and can be retried - core.info( - `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 + // Rate limit? + if (err.httpStatusCode === 403) { core.error( - `Received HTTP status code ${statusCode}. Access is forbidden. Please check your credentials or permissions.` + `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.info( + `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 { - // Other HTTP errors - core.info(`Received HTTP error ${statusCode}: ${err.message}`); + core.info(err.message); } - if (err.stack) { - core.debug(`Stack trace: ${err.stack}`); + core.debug(err.stack); } } - throw err; } }