diff options
| author | 2022-09-05 14:24:51 +0200 | |
|---|---|---|
| committer | 2022-09-05 14:24:51 +0200 | |
| commit | ee01e030d4b88af2b3deab818d0405a326ba218a (patch) | |
| tree | ecf120e1958cb834b6854a97c8228e4181813bfd /web | |
| parent | [frontend] Transition neatly from cropped photos (#802) (diff) | |
| download | gotosocial-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')
| -rw-r--r-- | web/source/panels/lib/oauth.js | 6 | 
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; +			}  		});  	} | 
