diff options
-rw-r--r-- | src/routes/player/[player]/[profile].svelte | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/routes/player/[player]/[profile].svelte b/src/routes/player/[player]/[profile].svelte index caf348b..bc6c18d 100644 --- a/src/routes/player/[player]/[profile].svelte +++ b/src/routes/player/[player]/[profile].svelte @@ -8,7 +8,14 @@ const profile: string = params.profile const data: CleanMemberProfile = await fetch( `${API_URL}player/${player}/${profile}?customization=true` - ).then(r => r.json()) + ).then(async r => { + const text = await r.text() + try { + return JSON.parse(text) + } catch (e) { + throw new Error(`Invalid JSON: ${text}`) + } + }) if (!data.member) { return { |