Skip to content

Commit

Permalink
Fix: catch 400/500 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Nov 26, 2023
1 parent 1bd9bc2 commit ccdae1a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ async function fetchBlob(
// Fetch the resource
const response = await fetch(url, requestInit)

if (!response.ok) {
throw new Error(`Failed to fetch ${url}: ${response.status} (${response.statusText})`)
}

// Read the data to track progress
watchProgress(response.clone(), progressCallback)

Expand Down

0 comments on commit ccdae1a

Please sign in to comment.