mirror of
https://github.com/cassoule/flopobot_v2.git
synced 2026-01-18 16:37:40 +01:00
fix
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user