From af62cbd86aa0de851de541e02d5c4283aad2aeb5 Mon Sep 17 00:00:00 2001 From: milo Date: Sat, 16 Aug 2025 18:39:06 +0200 Subject: [PATCH] fix --- src/api/discord.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/discord.js b/src/api/discord.js index 18cf8c1..9699eee 100644 --- a/src/api/discord.js +++ b/src/api/discord.js @@ -30,7 +30,12 @@ export async function DiscordRequest(endpoint, options) { // If the request was not successful, throw a detailed error if (!res.ok) { - const data = await res.json(); + let data + try { + data = await res.json(); + } catch (err) { + data = res; + } console.error(`Discord API Error on endpoint ${endpoint}:`, res.status, data); throw new Error(JSON.stringify(data)); }