ab-ms-core / app /core /exceptions.py
MukeshKapoor25's picture
Implement project listing with pagination and sorting; add repository and service methods, update models and schemas, and include unit tests for functionality
b79b0dc
raw
history blame contribute delete
782 Bytes
from fastapi import HTTPException, status
class AuthException(HTTPException):
def __init__(self, detail: str = "Authentication failed"):
super().__init__(status_code=status.HTTP_401_UNAUTHORIZED, detail=detail)
class NotFoundException(HTTPException):
def __init__(self, detail: str = "Resource not found"):
super().__init__(status_code=status.HTTP_404_NOT_FOUND, detail=detail)
class BadRequestException(HTTPException):
def __init__(self, detail: str = "Bad request"):
super().__init__(status_code=status.HTTP_400_BAD_REQUEST, detail=detail)
class RepositoryException(HTTPException):
def __init__(self, detail: str = "Database operation failed"):
super().__init__(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=detail)