Skip to content

Commit

Permalink
Merge pull request #21 from arcxyz/patch-1
Browse files Browse the repository at this point in the history
Include the response object when a request fails
  • Loading branch information
zachleat authored Mar 17, 2023
2 parents 28201ee + ffecd5e commit fa2c28e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/RemoteAssetCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class RemoteAssetCache extends AssetCache {
let fetchOptions = optionsOverride.fetchOptions || this.options.fetchOptions || {};
let response = await fetch(this.url, fetchOptions);
if(!response.ok) {
throw new Error(`Bad response for ${this.displayUrl} (${response.status}): ${response.statusText}`)
let error = new Error(`Bad response for ${this.displayUrl} (${response.status}): ${response.statusText}`);
error.response = response;
throw error
}

let type = optionsOverride.type || this.options.type;
Expand Down

0 comments on commit fa2c28e

Please sign in to comment.