Skip to content

Commit

Permalink
fix: errorCallback invoke twice while script load failed with status 4xx
Browse files Browse the repository at this point in the history
  • Loading branch information
kuitos committed Mar 28, 2023
1 parent 67f07a0 commit 74592c1
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export function getExternalScripts(scripts, fetch = defaultFetch, errorCallback
// usually browser treats 4xx and 5xx response of script loading as an error and will fire a script error event
// https://stackoverflow.com/questions/5625420/what-http-headers-responses-trigger-the-onerror-handler-on-a-script-tag/5625603
if (response.status >= 400) {
errorCallback();
throw new Error(`${scriptUrl} load failed with status ${response.status}`);
}

Expand Down

0 comments on commit 74592c1

Please sign in to comment.