Skip to content

Commit

Permalink
use onerror in case of network error, remove forgotten console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
obiot committed Dec 16, 2023
1 parent 9a9ed71 commit 17bed15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/loader/parsers/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export function preloadBinary(data, onload, onerror) {
if (!response.ok) {
// status = 0 when file protocol is used, or cross-domain origin
if (response.status !== 0) {
throw new Error(`Network response was not ok ${response.statusText}`);
if (typeof onerror === "function") {
onerror(`Network response was not ok ${response.statusText}`);
}
}
}
return response.arrayBuffer();
Expand All @@ -36,7 +38,6 @@ export function preloadBinary(data, onload, onerror) {
}
})
.catch(error => {
console.error(error);
if (typeof onerror === "function") {
onerror(error);
}
Expand Down

0 comments on commit 17bed15

Please sign in to comment.