aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend-api-sender.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-07 21:04:58 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-08 21:44:25 -0400
commit6a6e200ef947b92576351e39fc30b6653a576d70 (patch)
treeebe6bce781d597eb04dbea85395d9795409897d0 /ext/fg/js/frontend-api-sender.js
parent88de4271843197d37243a9ac360236f9dfb414e1 (diff)
Update rejections to use Error
Diffstat (limited to 'ext/fg/js/frontend-api-sender.js')
-rw-r--r--ext/fg/js/frontend-api-sender.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/fg/js/frontend-api-sender.js b/ext/fg/js/frontend-api-sender.js
index 2e037e62..c6eeaeb2 100644
--- a/ext/fg/js/frontend-api-sender.js
+++ b/ext/fg/js/frontend-api-sender.js
@@ -31,7 +31,7 @@ class FrontendApiSender {
invoke(action, params, target) {
if (this.disconnected) {
- return Promise.reject('Disconnected');
+ return Promise.reject(new Error('Disconnected'));
}
if (this.port === null) {
@@ -110,8 +110,8 @@ class FrontendApiSender {
clearTimeout(info.timer);
info.timer = null;
- if (typeof data.error === 'string') {
- info.reject(data.error);
+ if (typeof data.error !== 'undefined') {
+ info.reject(jsonToError(data.error));
} else {
info.resolve(data.result);
}
@@ -122,7 +122,7 @@ class FrontendApiSender {
const info = this.callbacks[id];
delete this.callbacks[id];
info.timer = null;
- info.reject(reason);
+ info.reject(new Error(reason));
}
static generateId(length) {