Skip to content

Commit

Permalink
fix: something
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy committed Nov 14, 2024
1 parent be6c32a commit 5b5a9ce
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions comet/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ async def lifespan(app: FastAPI):
from fastapi.responses import JSONResponse
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request: Request, exc: RequestValidationError):

exc_str = f'{exc}'.replace('\n', ' ').replace(' ', ' ')
# or logger.error(f'{exc}')
logger.error(request, exc_str)
# Log both request and exception information in a single formatted message
logger.error(f"Request: {request.url} - Validation error: {exc_str}")
content = {'status_code': 10422, 'message': exc_str, 'data': None}
return JSONResponse(content=content, status_code=status.HTTP_422_UNPROCESSABLE_ENTITY)

Expand Down

0 comments on commit 5b5a9ce

Please sign in to comment.