diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-09-22 19:39:05 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-09-22 19:39:05 -0700 |
commit | 8ba8397170c99e1d4416277e26d91ebb4b8cfed1 (patch) | |
tree | cdb0dc4ce57c984d5db2db7361a25c9b30bb542f /ext/bg/js/request.js | |
parent | 27296de9f5c8283e81620999d8acedcdf9c117a5 (diff) |
update error handling
Diffstat (limited to 'ext/bg/js/request.js')
-rw-r--r-- | ext/bg/js/request.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/bg/js/request.js b/ext/bg/js/request.js index 94fd135a..e4359863 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 execute network request')); + xhr.addEventListener('error', () => reject('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 JSON response'); + return Promise.reject('Invalid response'); } }); } |