You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
711 B
22 lines
711 B
from fastapi import HTTPException, status |
|
|
|
class PietanzaNotFoundError(HTTPException): |
|
def __init__(self, pietanza_id: int): |
|
super().__init__( |
|
status_code=status.HTTP_404_NOT_FOUND, |
|
detail=f"Pietanza con id {pietanza_id} non trovata" |
|
) |
|
|
|
class ValidationError(HTTPException): |
|
def __init__(self, detail: str): |
|
super().__init__( |
|
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, |
|
detail=detail |
|
) |
|
|
|
class DatabaseError(HTTPException): |
|
def __init__(self, detail: str = "Operazione database fallita"): |
|
super().__init__( |
|
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, |
|
detail=detail |
|
)
|
|
|