- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 23 for exception_handlers (0.08 sec)
-
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) -
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) -
fastapi/applications.py
) self.exception_handlers: dict[ Any, Callable[[Request, Any], Union[Response, Awaitable[Response]]] ] = {} if exception_handlers is None else dict(exception_handlers) self.exception_handlers.setdefault(HTTPException, http_exception_handler) self.exception_handlers.setdefault( RequestValidationError, request_validation_exception_handlerRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 176.3K bytes - Viewed (0) -
docs/en/docs/tutorial/handling-errors.md
If you want to use the exception along with the same default exception handlers from **FastAPI**, you can import and reuse the default exception handlers from `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 - 9K bytes - Viewed (0) -
docs/ja/docs/tutorial/handling-errors.md
```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### **FastAPI** の例外ハンドラの再利用 また、何らかの方法で例外を使用することもできますが、**FastAPI** から同じデフォルトの例外ハンドラを使用することもできます。 デフォルトの例外ハンドラを`fastapi.exception_handlers`からインポートして再利用することができます: {* ../../docs_src/handling_errors/tutorial006.py hl[2,3,4,5,15,21] *} この例では、非常に表現力のあるメッセージでエラーを`print`しています。Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 11.6K bytes - Viewed (0)