fix: improved error when downloading from GitHub fails

This commit is contained in:
Marcello Bachechi 2025-07-17 00:37:51 -06:00 committed by GitHub
parent f82c20f02a
commit 5baf78ede6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,10 +20,16 @@ export async function downloadUrl(url: string, file: string): Promise<void> {
process.env.HTTP_PROXY ??
process.env.http_proxy;
const res = await fetch(
url,
proxy ? { agent: httpsProxyAgent(proxy) } : undefined
);
let res;
try {
res = await fetch(
url,
proxy ? { agent: httpsProxyAgent(proxy) } : undefined
);
} catch (err) {
log.disableProgress();
throw wasReported(`Network error during fetch: ${(err as Error).message}`);
}
if (!res.ok) {
log.disableProgress();