- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 33 for exception_handlers (0.55 sec)
-
fastapi/exception_handlers.py
Ben Beasley <******@****.***> 1758043308 +0100
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Sep 16 17:21:48 UTC 2025 - 1.2K bytes - Viewed (0) -
docs_src/handling_errors/tutorial006_py39.py
from fastapi import FastAPI, HTTPException from fastapi.exception_handlers import ( http_exception_handler, request_validation_exception_handler, ) 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)}")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 928 bytes - Viewed (0) -
tests/test_exception_handlers.py
def server_error_exception_handler(request, exception): return JSONResponse(status_code=500, content={"exception": "server-error"}) app = FastAPI( exception_handlers={ HTTPException: http_exception_handler, RequestValidationError: request_validation_exception_handler, Exception: server_error_exception_handler, } ) client = TestClient(app)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Dec 03 22:37:12 UTC 2024 - 2.4K bytes - Viewed (0) -
tests/test_ws_router.py
""" async def custom_handler(websocket: WebSocket, exc: CustomError) -> None: await websocket.close(1002, "foo") myapp = make_app(exception_handlers={CustomError: custom_handler}) client = TestClient(myapp) with pytest.raises(WebSocketDisconnect) as e: with client.websocket_connect("/custom_error/"): pass # pragma: no coverRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Jun 11 19:08:14 UTC 2023 - 7.5K bytes - Viewed (0) -
docs/de/docs/tutorial/handling-errors.md
```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### Die Exceptionhandler von **FastAPI** wiederverwenden { #reuse-fastapis-exception-handlers } Wenn Sie die Exception zusammen mit den gleichen Default-Exceptionhandlern von **FastAPI** verwenden möchten, können Sie die Default-Exceptionhandler aus `fastapi.exception_handlers` importieren und wiederverwenden:Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 10.4K bytes - Viewed (0) -
docs/ru/docs/tutorial/handling-errors.md
Если вы хотите использовать исключение вместе с теми же обработчиками исключений по умолчанию из **FastAPI**, вы можете импортировать и повторно использовать обработчики исключений по умолчанию из `fastapi.exception_handlers`: {* ../../docs_src/handling_errors/tutorial006_py39.py hl[2:5,15,21] *}Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 14.1K bytes - Viewed (0) -
docs/uk/docs/tutorial/handling-errors.md
Якщо Ви хочете використовувати помилки разом із такими ж обробниками помилок за замовчуванням, як у **FastAPI**, Ви можете імпортувати та повторно використовувати їх із `fastapi.exception_handlers`: {* ../../docs_src/handling_errors/tutorial006.py hl[2:5,15,21] *}Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 13.9K bytes - Viewed (0) -
docs/zh/docs/tutorial/handling-errors.md
```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### 复用 **FastAPI** 异常处理器 FastAPI 支持先对异常进行某些处理,然后再使用 **FastAPI** 中处理该异常的默认异常处理器。 从 `fastapi.exception_handlers` 中导入要复用的默认异常处理器: {* ../../docs_src/handling_errors/tutorial006.py hl[2:5,15,21] *} 虽然,本例只是输出了夸大其词的错误信息。Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 8.2K bytes - Viewed (0) -
docs/pt/docs/tutorial/handling-errors.md
Se você quer usar a exceção em conjunto com o mesmo manipulador de exceção *default* do **FastAPI**, você pode importar e re-usar esses manipuladores de exceção do `fastapi.exception_handlers`: {* ../../docs_src/handling_errors/tutorial006_py39.py hl[2:5,15,21] *}Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 10.2K bytes - Viewed (0) -
docs/es/docs/tutorial/handling-errors.md
Si quieres usar la excepción junto con los mismos manejadores de excepciones predeterminados de **FastAPI**, puedes importar y reutilizar los manejadores de excepciones predeterminados de `fastapi.exception_handlers`: {* ../../docs_src/handling_errors/tutorial006_py39.py hl[2:5,15,21] *}Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 9.7K bytes - Viewed (0)