kvcache-ai-ktransformers/ktransformers/server/exceptions.py
2024-07-27 16:06:58 +08:00

23 lines
578 B
Python

from fastapi import HTTPException, status
def db_exception():
return HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="DB Error",
)
def not_implemented(what):
return HTTPException(
status_code=status.HTTP_501_NOT_IMPLEMENTED,
detail=f"{what} not implemented",
)
def internal_server_error(what):
return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=f"{what}")
def request_error(what):
return HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=f"{what}")