- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 26 for RequestValidationError (0.23 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs/ja/docs/tutorial/handling-errors.md
/// /// warning | 注意 `RequestValidationError`には、検証エラーが発生したファイル名と行番号の情報が含まれているため、必要であれば関連情報と一緒にログに表示できます。 しかし、そのまま文字列に変換して直接その情報を返すと、システムに関する情報が多少漏えいする可能性があります。そのため、ここではコードが各エラーを個別に抽出して表示します。 /// ### `RequestValidationError`のボディの使用 { #use-the-requestvalidationerror-body } `RequestValidationError`には無効なデータを含む`body`が含まれています。 アプリ開発中にボディのログを取ってデバッグしたり、ユーザーに返したりなどに使用することができます。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 11.2K bytes - Click Count (0) -
docs/en/docs/tutorial/handling-errors.md
When a request contains invalid data, **FastAPI** internally raises a `RequestValidationError`. And it also includes a default exception handler for it. To override it, import the `RequestValidationError` and use it with `@app.exception_handler(RequestValidationError)` to decorate the exception handler. The exception handler will receive a `Request` and the exception.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 8.9K bytes - Click Count (0) -
docs_src/handling_errors/tutorial006_py310.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)}")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 928 bytes - Click Count (0) -
docs/en/docs/how-to/custom-request-and-route.md
/// tip To solve this same problem, it's probably a lot easier to use the `body` in a custom handler for `RequestValidationError` ([Handling Errors](../tutorial/handling-errors.md#use-the-requestvalidationerror-body)). But this example is still valid and it shows how to interact with the internal components. ///
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 4.4K bytes - Click Count (0) -
docs/zh-hant/docs/how-to/custom-request-and-route.md
但由於我們修改了 `GzipRequest.body`,在 **FastAPI** 需要讀取本文時,請求本文會自動解壓縮。 ## 在例外處理器中存取請求本文 { #accessing-the-request-body-in-an-exception-handler } /// tip 要解決相同問題,使用針對 `RequestValidationError` 的自訂處理器來讀取 `body` 通常更簡單([處理錯誤](../tutorial/handling-errors.md#use-the-requestvalidationerror-body))。 但本範例仍然有效,並示範了如何與內部元件互動。 /// 我們也可以用同樣的方法,在例外處理器中存取請求本文。 我們只需要在 `try`/`except` 區塊中處理請求即可:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 4.2K bytes - Click Count (0) -
docs/ja/docs/how-to/custom-request-and-route.md
## 例外ハンドラでのリクエストボディへのアクセス { #accessing-the-request-body-in-an-exception-handler } /// tip | 豆知識 同じ問題を解決するには、`RequestValidationError` 用のカスタムハンドラで `body` を使う方がずっと簡単でしょう([エラー処理](../tutorial/handling-errors.md#use-the-requestvalidationerror-body))。 ただし、この例も有効で、内部コンポーネントとどのようにやり取りするかを示しています。 /// 同じアプローチを使って、例外ハンドラ内でリクエストボディにアクセスすることもできます。 やることは、`try`/`except` ブロックの中でリクエストを処理するだけです:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 5.4K bytes - Click Count (0) -
fastapi/exceptions.py
for err in self._errors: message += f" {err}\n" message += self._format_endpoint_context() return message.rstrip() class RequestValidationError(ValidationException): def __init__( self, errors: Sequence[Any], *, body: Any = None, endpoint_ctx: EndpointContext | None = None, ) -> None:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 11 18:41:21 GMT 2026 - 7.3K bytes - Click Count (0) -
docs/ru/docs/tutorial/handling-errors.md
Когда запрос содержит недопустимые данные, **FastAPI** внутренне вызывает ошибку `RequestValidationError`. А также включает в себя обработчик исключений по умолчанию. Чтобы переопределить его, импортируйте `RequestValidationError` и используйте его с `@app.exception_handler(RequestValidationError)` для создания обработчика исключений. Обработчик исключения получит объект `Request` и исключение.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 17:56:20 GMT 2026 - 14K bytes - Click Count (0) -
docs/de/docs/tutorial/handling-errors.md
Wenn ein Request ungültige Daten enthält, löst **FastAPI** intern einen `RequestValidationError` aus. Und es enthält auch einen Default-Exceptionhandler für diesen. Um diesen zu überschreiben, importieren Sie den `RequestValidationError` und verwenden Sie ihn mit `@app.exception_handler(RequestValidationError)`, um den Exceptionhandler zu dekorieren. Der Exceptionhandler erhält einen `Request` und die Exception.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 17:58:09 GMT 2026 - 10.3K bytes - Click Count (0) -
docs_src/handling_errors/tutorial004_py310.py
from fastapi import FastAPI, HTTPException from fastapi.exceptions import RequestValidationError from fastapi.responses import PlainTextResponse from starlette.exceptions import HTTPException as StarletteHTTPException app = FastAPI() @app.exception_handler(StarletteHTTPException) async def http_exception_handler(request, exc): return PlainTextResponse(str(exc.detail), status_code=exc.status_code)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 920 bytes - Click Count (0)