fix: error catch

This commit is contained in:
idranme
2024-07-10 03:25:25 +00:00
parent ee9187f8a9
commit 335a97d425

View File

@@ -160,7 +160,12 @@ export async function httpDownload(options: string | HttpDownloadOptions): Promi
}
}
}
const fetchRes = await fetch(url, { headers });
const fetchRes = await fetch(url, { headers }).catch((err) => {
if(err.cause){
throw err.cause
}
throw err
});
if (!fetchRes.ok) throw new Error(`下载文件失败: ${fetchRes.statusText}`);
const blob = await fetchRes.blob();