- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for exceptions (0.2 sec)
-
docs/en/docs/tutorial/handling-errors.md
``` ## Install custom exception handlers You can add custom exception handlers with <a href="https://www.starlette.io/exceptions/" class="external-link" target="_blank">the same exception utilities from Starlette</a>. Let's say you have a custom exception `UnicornException` that you (or a library you use) might `raise`. And you want to handle this exception globally with FastAPI.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.1K bytes - Viewed (0) -
docs/de/docs/tutorial/handling-errors.md
Nehmen wir an, Sie haben eine benutzerdefinierte Exception `UnicornException`, die Sie (oder eine Bibliothek, die Sie verwenden) `raise`n könnten. Und Sie möchten diese Exception global mit FastAPI handhaben.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Mar 30 20:28:29 GMT 2024 - 10.6K bytes - Viewed (0) -
docs/ru/docs/tutorial/handling-errors.md
```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### Переиспользование обработчиков исключений **FastAPI** Если вы хотите использовать исключение вместе с теми же обработчиками исключений по умолчанию из **FastAPI**, вы можете импортировать и повторно использовать обработчики исключений по умолчанию из `fastapi.exception_handlers`: ```Python hl_lines="2-5 15 21"
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 14.5K bytes - Viewed (0) -
docs/pt/docs/tutorial/handling-errors.md
```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### Re-use os manipulares de exceção do **FastAPI** 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`: ```Python hl_lines="2-5 15 21"
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 10K bytes - Viewed (0) -
docs/zh/docs/tutorial/handling-errors.md
添加自定义处理器,要使用 [Starlette 的异常工具](https://www.starlette.io/exceptions/)。 假设要触发的自定义异常叫作 `UnicornException`。 且需要 FastAPI 实现全局处理该异常。 此时,可以用 `@app.exception_handler()` 添加自定义异常控制器: ```Python hl_lines="5-7 13-18 24" {!../../../docs_src/handling_errors/tutorial003.py!} ``` 请求 `/unicorns/yolo` 时,路径操作会触发 `UnicornException`。 但该异常将会被 `unicorn_exception_handler` 处理。 接收到的错误信息清晰明了,HTTP 状态码为 `418`,JSON 内容如下:
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 8.4K bytes - Viewed (0) -
docs/em/docs/tutorial/handling-errors.md
``` ## ❎ 🛃 ⚠ 🐕🦺 👆 💪 🚮 🛃 ⚠ 🐕🦺 ⏮️ <a href="https://www.starlette.io/exceptions/" class="external-link" target="_blank">🎏 ⚠ 🚙 ⚪️➡️ 💃</a>. ➡️ 💬 👆 ✔️ 🛃 ⚠ `UnicornException` 👈 👆 (⚖️ 🗃 👆 ⚙️) 💪 `raise`. & 👆 💚 🍵 👉 ⚠ 🌐 ⏮️ FastAPI. 👆 💪 🚮 🛃 ⚠ 🐕🦺 ⏮️ `@app.exception_handler()`: ```Python hl_lines="5-7 13-18 24" {!../../../docs_src/handling_errors/tutorial003.py!} ```
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 8.3K bytes - Viewed (0) -
docs/ja/docs/tutorial/handling-errors.md
``` ## カスタム例外ハンドラのインストール カスタム例外ハンドラは<a href="https://www.starlette.io/exceptions/" class="external-link" target="_blank">Starletteと同じ例外ユーティリティ</a>を使用して追加することができます。 あなた(または使用しているライブラリ)が`raise`するかもしれないカスタム例外`UnicornException`があるとしましょう。 そして、この例外をFastAPIでグローバルに処理したいと思います。 カスタム例外ハンドラを`@app.exception_handler()`で追加することができます: ```Python hl_lines="5 6 7 13 14 15 16 17 18 24"
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 11.8K bytes - Viewed (0)