aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend-api-sender.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2019-10-10 19:50:30 -0700
committerAlex Yatskov <alex@foosoft.net>2019-10-10 19:50:30 -0700
commit06d7713189be9eb51669d3842b78278371e6cfa4 (patch)
treee98640dc323c486fb1190280502acbf2fe9d8187 /ext/fg/js/frontend-api-sender.js
parent499239ce94e0480783af93f813c2b4096b495808 (diff)
parent55b2c1d8f51c658b0457ae8329fb1b0e52f5f799 (diff)
Merge branch 'master' into testing
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) {