aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-06 14:36:43 -0400
committerGitHub <noreply@github.com>2020-09-06 14:36:43 -0400
commitb28241dbf23b627e252348aa0445e4e7befe01fc (patch)
tree7fe05589ccdc2a3e6fb1b8df0dfb4c85fb0a4bc9 /ext/bg
parent44f38c4dea6d517bb7657063ed2394745945c1f8 (diff)
Fix error handling for screenshot captures (#777)
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/backend.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 2c741dd7..a9ef4ce4 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -537,8 +537,15 @@ class Backend {
}
const windowId = sender.tab.windowId;
- return new Promise((resolve) => {
- chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => resolve(dataUrl));
+ return new Promise((resolve, reject) => {
+ chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => {
+ const e = chrome.runtime.lastError;
+ if (e) {
+ reject(new Error(e.message));
+ } else {
+ resolve(dataUrl);
+ }
+ });
});
}