summaryrefslogtreecommitdiff
path: root/ext/bg/js/request.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/bg/js/request.js
parent88de4271843197d37243a9ac360236f9dfb414e1 (diff)
Update rejections to use Error
Diffstat (limited to 'ext/bg/js/request.js')
-rw-r--r--ext/bg/js/request.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/bg/js/request.js b/ext/bg/js/request.js
index e4359863..3afc1506 100644
--- a/ext/bg/js/request.js
+++ b/ext/bg/js/request.js
@@ -22,7 +22,7 @@ function requestJson(url, action, params) {
const xhr = new XMLHttpRequest();
xhr.overrideMimeType('application/json');
xhr.addEventListener('load', () => resolve(xhr.responseText));
- xhr.addEventListener('error', () => reject('Failed to connect'));
+ xhr.addEventListener('error', () => reject(new Error('Failed to connect')));
xhr.open(action, url);
if (params) {
xhr.send(JSON.stringify(params));
@@ -34,7 +34,7 @@ function requestJson(url, action, params) {
return JSON.parse(responseText);
}
catch (e) {
- return Promise.reject('Invalid response');
+ return Promise.reject(new Error('Invalid response'));
}
});
}