INNER CODE UNIT · Python
http_exception_handler
LoD-Dawn/Fast-Vben-Admin · backend/app/main.py:191
async def http_exception_handler(_request: Request, exc: HTTPException) -> JSONResponse:
detail = exc.detail if isinstance(exc.detail, str) else "Request failed"
return error_response(
status_code=exc.status_code,
code=resolve_error_code(
status_code=exc.status_code, detail=detail, path=_request.url.path
),
message=detail,
details={} if isinstance(exc.detail, str) else {"detail": exc.detail},
)
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(
_request: Request, exc: RequestValidationError
) -> JSONResponse:
return error_response(
status_code=422,