summaryrefslogtreecommitdiff
path: root/web/source/panels/lib/oauth.js
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-09-05 14:24:51 +0200
committerLibravatar GitHub <noreply@github.com>2022-09-05 14:24:51 +0200
commitee01e030d4b88af2b3deab818d0405a326ba218a (patch)
treeecf120e1958cb834b6854a97c8228e4181813bfd /web/source/panels/lib/oauth.js
parent[frontend] Transition neatly from cropped photos (#802) (diff)
downloadgotosocial-ee01e030d4b88af2b3deab818d0405a326ba218a.tar.xz
[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 (limited to 'web/source/panels/lib/oauth.js')
-rw-r--r--web/source/panels/lib/oauth.js6
1 files changed, 6 insertions, 0 deletions
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;
+ }
});
}