Files
2021-04-25 17:17:21 +08:00

34 lines
741 B
Python

from fastapi import HTTPException
from starlette.status import HTTP_500_INTERNAL_SERVER_ERROR
class ServerHTTPException(HTTPException):
def __init__(self, error: str = None):
super(ServerHTTPException, self).__init__(
status_code=HTTP_500_INTERNAL_SERVER_ERROR, detail=error
)
class InvalidResource(ServerHTTPException):
"""
raise when has invalid resource
"""
class NoSuchFieldFound(ServerHTTPException):
"""
raise when no such field for the given
"""
class FileMaxSizeLimit(ServerHTTPException):
"""
raise when the upload file exceeds the max size
"""
class FileExtNotAllowed(ServerHTTPException):
"""
raise when the upload file ext not allowed
"""