aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/request.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-21 19:08:56 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-21 19:08:56 -0500
commit26ea278c29dbb19d003dddda2e60559c502d0cc3 (patch)
treeb13a72cd9926f37c27c8bec8dfb4ccf5d7fe85a4 /ext/bg/js/request.js
parent1fd568ab8e7c909010e843654540162baeab9e1e (diff)
Improve debug logging
Diffstat (limited to 'ext/bg/js/request.js')
-rw-r--r--ext/bg/js/request.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/bg/js/request.js b/ext/bg/js/request.js
index 778f933b..02eed6fb 100644
--- a/ext/bg/js/request.js
+++ b/ext/bg/js/request.js
@@ -36,8 +36,9 @@ async function requestJson(url, action, params) {
const responseText = await requestText(url, action, params);
try {
return JSON.parse(responseText);
- }
- catch (e) {
- throw new Error('Invalid response');
+ } catch (e) {
+ const error = new Error(`Invalid response (${e.message || e})`);
+ error.data = {url, action, params, responseText};
+ throw error;
}
}