mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 16:57:22 +00:00
Adding unauthorized error handling in runMethod
This commit is contained in:
@@ -35,6 +35,12 @@ export async function runMethod<T = any>(
|
||||
throw errorStack;
|
||||
});
|
||||
|
||||
if (!result.ok) {
|
||||
errorStack.message = result.statusText as Error['message'];
|
||||
console.error(`Invalid authorization key.`);
|
||||
throw errorStack;
|
||||
}
|
||||
|
||||
return result.status !== 204 ? await result.json() : undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user