from fastapi import HTTPException class ObjectNotFoundInDB(Exception): def __init__(self, *args): super().__init__(*args) class UserNotFound(HTTPException): def __init__( self, status_code=404, detail={ "message": "Didn't find a user with the provided id.", "code": "user-not-found", }, headers=None, ): super().__init__(status_code, detail, headers) class QueryValidationError(ValueError): def __init__(self, loc: list[str], msg: str): self.loc = loc self.msg = msg super().__init__(msg) class QueryNotFound(HTTPException): def __init__( self, status_code=404, detail={ "message": "The referenced query was not found.", "code": "query-not-found", }, headers=None, ): super().__init__(status_code, detail, headers) class ConnectionNotFound(HTTPException): def __init__( self, status_code=404, detail={ "message": "The referenced connection was not found.", "code": "connection-not-found", }, headers=None, ): super().__init__(status_code, detail, headers) class PoolNotFound(HTTPException): def __init__( self, status_code=404, detail={ "message": "We didn't find a running Pool for the referenced connection.", "code": "pool-not-found", }, headers=None, ): super().__init__(status_code, detail, headers) class CursorNotFound(HTTPException): def __init__( self, status_code=404, detail={ "message": "We didn't find a Cursor with the provided ID.", "code": "cursor-not-found", }, headers=None, ): super().__init__(status_code, detail, headers) class ClosedCursorUsage(HTTPException): def __init__( self, status_code=400, detail={ "message": "The Cursor you are trying to use is closed.", "code": "cursor-closed", }, headers=None, ): super().__init__(status_code, detail, headers)