mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-16 19:12:24 +00:00
fix(FormatUtils): Throw an error if download requests fails
This commit is contained in:
@@ -90,6 +90,10 @@ export async function download(
|
||||
signal: cancel.signal
|
||||
});
|
||||
|
||||
// Throw if the response is not 2xx
|
||||
if (!response.ok)
|
||||
throw new InnertubeError('The server responded with a non 2xx status code', { error_type: 'FETCH_FAILED', response });
|
||||
|
||||
const body = response.body;
|
||||
|
||||
if (!body)
|
||||
|
||||
Reference in New Issue
Block a user