- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 24 for exception_handler (0.13 sec)
-
docs/ja/docs/tutorial/handling-errors.md
あなた(または使用しているライブラリ)が`raise`するかもしれないカスタム例外`UnicornException`があるとしましょう。 そして、この例外をFastAPIでグローバルに処理したいと思います。 カスタム例外ハンドラを`@app.exception_handler()`で追加することができます: ```Python hl_lines="5 6 7 13 14 15 16 17 18 24" {!../../docs_src/handling_errors/tutorial003.py!} ``` ここで、`/unicorns/yolo`をリクエストすると、*path operation*は`UnicornException`を`raise`します。
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 11.8K 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`。
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 8.4K 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_handler
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Aug 17 04:52:31 UTC 2024 - 172.2K bytes - Viewed (0) -
impl/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java
* under the License. */ package org.apache.maven.exception; /** * Transform an exception into useful end-user message. * * @since 3.0-alpha-3 */ public interface ExceptionHandler { ExceptionSummary handleException(Throwable e);
Registered: Sun Nov 03 03:35:11 UTC 2024 - Last Modified: Fri Oct 25 12:31:46 UTC 2024 - 1023 bytes - Viewed (0) -
fastapi/exception_handlers.py
Kristján Valur Jónsson <******@****.***> 1686510494 +0000
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Jun 11 19:08:14 UTC 2023 - 1.3K bytes - Viewed (0) -
docs/de/docs/tutorial/dependencies/dependencies-with-yield.md
Abhängigkeit mit `yield` abfangen, oder mit einem [benutzerdefinierten Exceptionhandler](../handling-errors.md#benutzerdefinierte-exceptionhandler-definieren){.internal-link target=_blank} erstellt haben. Wenn Sie eine Exception auslösen, wird diese mit yield an die Abhängigkeiten übergeben, einschließlich `HTTPException`, und dann **erneut** an die Exceptionhandler. Wenn es für diese Exception keinen Exceptionhandler gibt, wird sie von der internen Default-`ServerErrorMiddleware` gehandhabt,...
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 13.4K 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 Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Feb 17 12:40:12 UTC 2022 - 1.9K bytes - Viewed (0) -
docs/de/docs/how-to/custom-request-and-route.md
Aufgrund unserer Änderungen in `GzipRequest.body` wird der Requestbody jedoch bei Bedarf automatisch dekomprimiert, wenn er von **FastAPI** geladen wird. ## Zugriff auf den Requestbody in einem Exceptionhandler /// tip | "Tipp"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.2K 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 cover
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Jun 11 19:08:14 UTC 2023 - 7.5K bytes - Viewed (0) -
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvn/DefaultMavenInvoker.java
import org.apache.maven.cling.invoker.Utils; import org.apache.maven.eventspy.internal.EventSpyDispatcher; import org.apache.maven.exception.DefaultExceptionHandler; import org.apache.maven.exception.ExceptionHandler; import org.apache.maven.exception.ExceptionSummary; import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.ExecutionListener;
Registered: Sun Nov 03 03:35:11 UTC 2024 - Last Modified: Fri Oct 25 12:31:46 UTC 2024 - 29.8K bytes - Viewed (0)