todoapp-rx2ww5/app/core/exceptions.py
2025-05-24 15:14:55 +00:00

17 lines
479 B
Python

from fastapi import HTTPException, status
class TodoNotFoundException(HTTPException):
def __init__(self, todo_id: int):
super().__init__(
status_code=status.HTTP_404_NOT_FOUND,
detail=f"Todo with ID {todo_id} not found"
)
class BadRequestException(HTTPException):
def __init__(self, detail: str = "Bad request"):
super().__init__(
status_code=status.HTTP_400_BAD_REQUEST,
detail=detail
)