diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2019-09-05 09:25:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-05 09:25:42 +0300 |
commit | 9cd0101b62fe99d736b4e6b9072c2aa4827311af (patch) | |
tree | 822811aae7528487bc4ebb17d363cdb4b7b0b00c /ext/fg/js/util.js | |
parent | 4ac55da7dd5354e6c3495f04583352d0d863b7b6 (diff) | |
parent | 9028b55774f788f0b61acadb8d3ba85b2bfab34a (diff) |
Merge pull request #185 from toasted-nutbread/recursive-popups
Recursive popups
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) { |