Skip to content

Commit

Permalink
LoginFile: avoid swallowing errors in canvas.toBlob
Browse files Browse the repository at this point in the history
  • Loading branch information
danimoh committed Sep 4, 2024
1 parent d41923b commit dd38145
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/LoginFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ class LoginFile {
async toObjectUrl() {
await this._drawPromise;

return new Promise(resolve => {
return new Promise((resolve, reject) => {
this.$canvas.toBlob(blob => {
if (!blob) throw new Error('Cannot generate URL');
if (!blob) {
reject(new Error('Cannot generate URL'));
return;
}
const url = URL.createObjectURL(blob);
resolve(url);
});
Expand Down

0 comments on commit dd38145

Please sign in to comment.