Skip to content

Commit

Permalink
fix(FormatUtils): Throw an error if download requests fails
Browse files Browse the repository at this point in the history
  • Loading branch information
cjh980402 authored Jun 28, 2024
1 parent bd9f6ac commit a19511d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/FormatUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a19511d

Please sign in to comment.