From f79cdad3ee57e1d737dbff4f66a0efc7c04478e2 Mon Sep 17 00:00:00 2001 From: Tarrgon <61888458+Tarrgon@users.noreply.github.com> Date: Fri, 9 Jan 2026 20:40:03 -0500 Subject: [PATCH] Throw json data properly --- src/utils/oauth2.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/utils/oauth2.ts b/src/utils/oauth2.ts index c2f0ede..b75e2ef 100644 --- a/src/utils/oauth2.ts +++ b/src/utils/oauth2.ts @@ -105,8 +105,15 @@ export class DiscordOAuth2 { if (res.status < 200 || res.status >= 300) { console.error(`Non 200 code while joining user: ${options.userId} to discord:`); - console.log(await res.text()); - return null; + const text = await res.text(); + console.error(text); + let data = null; + + try { + data = JSON.parse(text); + } catch { } + + throw data; } return await res.json();