eng: hint if rate limit error is reached on preinstall (#200993)

* eng: hint if rate limit error is reached on preinstall

Fixes #194790

* compile
This commit is contained in:
Connor Peet 2023-12-15 09:49:51 -08:00 committed by GitHub
parent a7cdc1e2a9
commit 64c8c3fe98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -73,7 +73,11 @@ async function fetchUrl(url, options, retries = 10, retryDelay = 1000) {
contents
});
}
throw new Error(`Request ${ansiColors.magenta(url)} failed with status code: ${response.status}`);
let err = `Request ${ansiColors.magenta(url)} failed with status code: ${response.status}`;
if (response.status === 403) {
err += ' (you may be rate limited)';
}
throw new Error(err);
}
finally {
clearTimeout(timeout);

View file

@ -81,7 +81,11 @@ export async function fetchUrl(url: string, options: IFetchOptions, retries = 10
contents
});
}
throw new Error(`Request ${ansiColors.magenta(url)} failed with status code: ${response.status}`);
let err = `Request ${ansiColors.magenta(url)} failed with status code: ${response.status}`;
if (response.status === 403) {
err += ' (you may be rate limited)';
}
throw new Error(err);
} finally {
clearTimeout(timeout);
}