fix: improved error when downloading from GitHub fails
This commit is contained in:
parent
f82c20f02a
commit
5baf78ede6
14
lib/utils.ts
14
lib/utils.ts
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user