From ee01e030d4b88af2b3deab818d0405a326ba218a Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 5 Sep 2022 14:24:51 +0200 Subject: [PATCH] [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 --- web/source/panels/lib/oauth.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/source/panels/lib/oauth.js b/web/source/panels/lib/oauth.js index 9cbf3d484..3619dfa01 100644 --- 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; + } }); }