diff options
author | Alex Yatskov <alex@foosoft.net> | 2019-09-05 20:21:07 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2019-09-05 20:21:07 -0700 |
commit | cfc6363a01ee00e89866c54709006d6f55d093de (patch) | |
tree | a03b1f79ba220e93c248ad8284fb01dc95b676a9 /ext/fg/js/util.js | |
parent | 5347da528bd07166b4686f45440d80a77f4888a3 (diff) | |
parent | c53263158b22f4be8e54696c4675f360f1813de8 (diff) |
Merge branch 'master' into testing
Diffstat (limited to 'ext/fg/js/util.js')
-rw-r--r-- | ext/fg/js/util.js | 6 |
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) { |