from litestar import Request, Response, MediaType

from advanced_alchemy.exceptions import NotFoundError


def not_found_exception_handler(_: Request, exc: NotFoundError) -> Response:
    """Default handler for NotFoundError."""
    return Response(
        media_type=MediaType.TEXT,
        content=f"Not found error: {exc.detail}",
        status_code=404,
    )


exception_handlers = {NotFoundError: not_found_exception_handler}
