forked from mirrors/gotosocial
[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>
This commit is contained in:
parent
58c00d9f2f
commit
ee01e030d4
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue