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
Wrap Xhr request sending in a try.
  • Loading branch information
exupero committed Dec 24, 2017
commit 5a17e41f7ff4711b1b680fc74572dce6a943ad1f
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