Refactor error handling by moving errors to a new file (#9)

*  Refactor error handling by moving errors to a new file
This commit is contained in:
2025-03-13 09:23:56 +01:00
committed by GitHub
parent 7a98827a23
commit 190dce6f5d
2 changed files with 13 additions and 8 deletions

View File

@@ -16,6 +16,7 @@ from fastapi import APIRouter, Depends, FastAPI, HTTPException, Request, Respons
from nacl.exceptions import BadSignatureError
from nacl.signing import VerifyKey
from .errors import InvalidCredentialsError
from .models import EventType, WebhookEventPayload, WebhookType
logger = logging.getLogger("pycord.rest")
@@ -36,14 +37,6 @@ class ApplicationAuthorizedEvent:
)
class PycordRestError(discord.DiscordException):
pass
class InvalidCredentialsError(PycordRestError):
pass
def not_supported[T, U](func: Callable[[T], U]) -> Callable[[T], U]:
@functools.wraps(func)
def inner(*args: T, **kwargs: T) -> U:

12
src/pycord_rest/errors.py Normal file
View File

@@ -0,0 +1,12 @@
# Copyright (c) Paillat-dev
# SPDX-License-Identifier: MIT
import discord
class PycordRestError(discord.DiscordException):
pass
class InvalidCredentialsError(PycordRestError):
pass