first commit

This commit is contained in:
xuyong
2026-04-15 21:35:26 +08:00
commit 7097fa6b44
69 changed files with 5642 additions and 0 deletions

21
app/core/exceptions.py Normal file
View File

@@ -0,0 +1,21 @@
from fastapi import HTTPException
class NotFoundError(HTTPException):
def __init__(self, detail: str = "Resource not found"):
super().__init__(status_code=404, detail=detail)
class BadRequestError(HTTPException):
def __init__(self, detail: str = "Bad request"):
super().__init__(status_code=400, detail=detail)
class UnauthorizedError(HTTPException):
def __init__(self, detail: str = "Not authenticated"):
super().__init__(status_code=401, detail=detail, headers={"WWW-Authenticate": "Bearer"})
class ForbiddenError(HTTPException):
def __init__(self, detail: str = "Forbidden"):
super().__init__(status_code=403, detail=detail)