Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Wrap Xhr request sending in a try. #154

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions saveSvgAsPng.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@
oReq.addEventListener('abort', transferFailed);
oReq.open('GET', font.url);
oReq.responseType = 'arraybuffer';
oReq.send();

try {
oReq.send();
} catch (e) {
transferFailed();
}

function fontLoaded() {
// TODO: it may be also worth to wait until fonts are fully loaded before
Expand All @@ -214,7 +219,9 @@

function transferFailed(e) {
console.warn('Failed to load font from: ' + font.url);
console.warn(e)
if(e) {
console.warn(e)
}
css += font.text + '\n';
processFontQueue(queue);
}
Expand All @@ -228,7 +235,6 @@
processFontQueue(queue)
}, 0);
}

}
}

Expand Down