Update file.ts

This commit is contained in:
idranme 2024-07-10 11:35:55 +08:00 committed by GitHub
parent 1327844736
commit 115120d066
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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