Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for custom_http_exception_handler (0.26 sec)

  1. docs_src/handling_errors/tutorial006.py

    )
    from fastapi.exceptions import RequestValidationError
    from starlette.exceptions import HTTPException as StarletteHTTPException
    
    app = FastAPI()
    
    
    @app.exception_handler(StarletteHTTPException)
    async def custom_http_exception_handler(request, exc):
        print(f"OMG! An HTTP error!: {repr(exc)}")
        return await http_exception_handler(request, exc)
    
    
    @app.exception_handler(RequestValidationError)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 11:10:33 GMT 2020
    - 928 bytes
    - Viewed (0)
Back to top