aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/util.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-08-17 18:50:48 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-02 19:31:42 -0400
commit5c4614f585648c2b835efc1d369e78918bc4f5ff (patch)
tree50f7aee35187192b7104752d953c18d52bcfba6c /ext/fg/js/util.js
parent4ac55da7dd5354e6c3495f04583352d0d863b7b6 (diff)
Add support for showing recursive popups
Diffstat (limited to 'ext/fg/js/util.js')
-rw-r--r--ext/fg/js/util.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js
index 7518beb5..dc99274e 100644
--- a/ext/fg/js/util.js
+++ b/ext/fg/js/util.js
@@ -24,9 +24,10 @@ function utilAsync(func) {
}
function utilInvoke(action, params={}) {
+ const data = {action, params};
return new Promise((resolve, reject) => {
try {
- chrome.runtime.sendMessage({action, params}, (response) => {
+ chrome.runtime.sendMessage(data, (response) => {
utilCheckLastError(chrome.runtime.lastError);
if (response !== null && typeof response === 'object') {
if (response.error) {
@@ -35,7 +36,8 @@ function utilInvoke(action, params={}) {
resolve(response.result);
}
} else {
- reject(`Unexpected response of type ${typeof response}`);
+ const message = response === null ? 'Unexpected null response' : `Unexpected response of type ${typeof response}`;
+ reject(`${message} (${JSON.stringify(data)})`);
}
});
} catch (e) {