mirror of
https://github.com/Paillat-dev/pycord-rest.git
synced 2026-01-02 00:56:19 +00:00
✨ 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:
@@ -16,6 +16,7 @@ from fastapi import APIRouter, Depends, FastAPI, HTTPException, Request, Respons
|
|||||||
from nacl.exceptions import BadSignatureError
|
from nacl.exceptions import BadSignatureError
|
||||||
from nacl.signing import VerifyKey
|
from nacl.signing import VerifyKey
|
||||||
|
|
||||||
|
from .errors import InvalidCredentialsError
|
||||||
from .models import EventType, WebhookEventPayload, WebhookType
|
from .models import EventType, WebhookEventPayload, WebhookType
|
||||||
|
|
||||||
logger = logging.getLogger("pycord.rest")
|
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]:
|
def not_supported[T, U](func: Callable[[T], U]) -> Callable[[T], U]:
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def inner(*args: T, **kwargs: T) -> U:
|
def inner(*args: T, **kwargs: T) -> U:
|
||||||
|
|||||||
12
src/pycord_rest/errors.py
Normal file
12
src/pycord_rest/errors.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (c) Paillat-dev
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
import discord
|
||||||
|
|
||||||
|
|
||||||
|
class PycordRestError(discord.DiscordException):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidCredentialsError(PycordRestError):
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user