mirror of
https://github.com/actions/setup-python.git
synced 2026-10-05 22:23:09 +01:00
Refactor isRateLimitError function for improved readability
This commit is contained in:
@@ -275,9 +275,7 @@ function sleep(ms: number): Promise<void> {
|
|||||||
// HTTP 403/429 from http-client (`statusCode`) or tool-cache (`httpStatusCode`).
|
// HTTP 403/429 from http-client (`statusCode`) or tool-cache (`httpStatusCode`).
|
||||||
function isRateLimitError(err: unknown): boolean {
|
function isRateLimitError(err: unknown): boolean {
|
||||||
const e = err as
|
const e = err as
|
||||||
| {httpStatusCode?: number; statusCode?: number}
|
{httpStatusCode?: number; statusCode?: number} | null | undefined;
|
||||||
| null
|
|
||||||
| undefined;
|
|
||||||
const status = e?.httpStatusCode ?? e?.statusCode;
|
const status = e?.httpStatusCode ?? e?.statusCode;
|
||||||
return status === 403 || status === 429;
|
return status === 403 || status === 429;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user