feat: add custom exceptions

This commit is contained in:
2026-05-09 14:49:15 +03:00
parent e929133db8
commit 499947e44e
17 changed files with 204 additions and 48 deletions

View File

@@ -0,0 +1,12 @@
from fastapi import Request
from fastapi.responses import ORJSONResponse
from starlette import status
from src.infrastructure.logger import logger
async def unhandled_exception_handler(_request: Request, exc: Exception) -> ORJSONResponse:
logger.exception(f'Unhandled exception: {type(exc).__name__}')
return ORJSONResponse(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
content={'detail': 'Internal Server Error','status_code': status.HTTP_500_INTERNAL_SERVER_ERROR},
)