commit ee01e030d4b88af2b3deab818d0405a326ba218a parent 58c00d9f2f0bdb0e51b619dbe4efdf5b39de922f Author: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 5 Sep 2022 14:24:51 +0200 [bugfix] Catch json syntax errors in the frontend + display a more helpful message (#804) * catch json syntax errors * update error msg * re-throw error with cause Co-authored-by: f0x52 <f0x@cthu.lu> Diffstat:
M | web/source/panels/lib/oauth.js | | | 6 | ++++++ |
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/web/source/panels/lib/oauth.js b/web/source/panels/lib/oauth.js @@ -184,6 +184,12 @@ module.exports = function oauthClient(config, initState) { } else { return json; } + }).catch(e => { + if (e instanceof SyntaxError) { + throw new Error("Error: The GtS API returned a non-json error. This usually means a network problem, or an issue with your instance's reverse proxy configuration.", {cause: e}); + } else { + throw e; + } }); }