diff --git a/package.json b/package.json index c74ffb2..0680fdf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anilist-extras", - "version": "2.7.4", + "version": "2.7.5", "description": "Adds a few additional features to AniList.", "scripts": { "build": "bun run build.ts", diff --git a/src/utils/Helpers.ts b/src/utils/Helpers.ts index f3047c9..2d9aa13 100644 --- a/src/utils/Helpers.ts +++ b/src/utils/Helpers.ts @@ -304,6 +304,15 @@ export const anilistApi = async ( data: JSON.stringify({ query, variables }), }); + if (response.status === 403) { + const errorMessage = response.json?.errors?.[0]?.message; + if (errorMessage?.includes('disabled')) { + console.error(errorMessage); + // eslint-disable-next-line @typescript-eslint/no-throw-literal + throw response; + } + } + // If the request failed and the user has an api token, check if the token is invalid. if (apiToken && useApiToken && response.status === 400) { const invalidToken = response.json.errors.some((error: any) => error.message === 'Invalid token');