diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-07 21:04:58 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-08 21:44:25 -0400 |
commit | 6a6e200ef947b92576351e39fc30b6653a576d70 (patch) | |
tree | ebe6bce781d597eb04dbea85395d9795409897d0 /ext/fg/js/util.js | |
parent | 88de4271843197d37243a9ac360236f9dfb414e1 (diff) |
Update rejections to use Error
Diffstat (limited to 'ext/fg/js/util.js')
-rw-r--r-- | ext/fg/js/util.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js index dc99274e..9a7968a7 100644 --- a/ext/fg/js/util.js +++ b/ext/fg/js/util.js @@ -30,19 +30,19 @@ function utilInvoke(action, params={}) { chrome.runtime.sendMessage(data, (response) => { utilCheckLastError(chrome.runtime.lastError); if (response !== null && typeof response === 'object') { - if (response.error) { - reject(response.error); + if (typeof response.error !== 'undefined') { + reject(jsonToError(response.error)); } else { resolve(response.result); } } else { const message = response === null ? 'Unexpected null response' : `Unexpected response of type ${typeof response}`; - reject(`${message} (${JSON.stringify(data)})`); + reject(new Error(`${message} (${JSON.stringify(data)})`)); } }); } catch (e) { window.yomichan_orphaned = true; - reject(e.message); + reject(e); } }); } |