Browse Source

Made the exception handler function `async` in code example

pull/13614/head
Yurii Motov 3 months ago
parent
commit
29c3b7beeb
  1. 2
      docs_src/handling_errors/tutorial008.py

2
docs_src/handling_errors/tutorial008.py

@ -18,7 +18,7 @@ class UnsupportedFileTypeError(HTTPException):
@app.exception_handler((FileTooLargeError, UnsupportedFileTypeError)) @app.exception_handler((FileTooLargeError, UnsupportedFileTypeError))
def custom_exception_handler(request: Request, exc: HTTPException): async def custom_exception_handler(request: Request, exc: HTTPException):
return JSONResponse( return JSONResponse(
status_code=exc.status_code, status_code=exc.status_code,
content={"error": exc.detail, "hint": "Need help? Contact support@example.com"}, content={"error": exc.detail, "hint": "Need help? Contact support@example.com"},

Loading…
Cancel
Save