[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:
tobi 2022-09-05 14:24:51 +02:00 committed by GitHub
parent 58c00d9f2f
commit ee01e030d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}
});
}