Skip to content

Commit

Permalink
ignore http errors when loading assets (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf authored Jan 2, 2024
1 parent 7b032d7 commit 704d9e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions static/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ async function progressiveFetch(resource, callbacks={}) {
const lengthBytes = response.headers.get('content-length');
let loadedBytes = 0;

// don't hang on error
if (response.status !== 200) {
cb.finish({ filename, lengthBytes: 0 });
}

function update() {
const loaded = Math.min(1.0, loadedBytes / lengthBytes);
const loadedPercent = loaded * 100.0;
Expand Down

0 comments on commit 704d9e6

Please sign in to comment.