- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 16 for StarletteHTTPException (0.39 seconds)
-
docs_src/handling_errors/tutorial006_py310.py
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)}") return await http_exception_handler(request, 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) -
tests/test_starlette_exception.py
from fastapi import FastAPI, HTTPException from fastapi.testclient import TestClient from inline_snapshot import snapshot from starlette.exceptions import HTTPException as StarletteHTTPException app = FastAPI() items = {"foo": "The Foo Wrestlers"} @app.get("/items/{item_id}") async def read_item(item_id: str): if item_id not in items: raise HTTPException( status_code=404, detail="Item not found",
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 8.1K bytes - Click Count (0) -
fastapi/exceptions.py
from pydantic import BaseModel, create_model from starlette.exceptions import HTTPException as StarletteHTTPException from starlette.exceptions import WebSocketException as StarletteWebSocketException class EndpointContext(TypedDict, total=False): function: str path: str file: str line: int class HTTPException(StarletteHTTPException): """
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/en/docs/tutorial/handling-errors.md
In this example, to be able to have both `HTTPException`s in the same code, Starlette's exceptions is renamed to `StarletteHTTPException`: ```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### Reuse **FastAPI**'s exception handlers { #reuse-fastapis-exception-handlers }
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/ja/docs/tutorial/handling-errors.md
これにより、Starletteの内部コードやStarletteの拡張機能やプラグインの一部がStarletteの`HTTPException`を発生させた場合、ハンドラがそれをキャッチして処理できるようになります。 この例では、同じコード内で両方の`HTTPException`を使用できるようにするために、Starletteの例外を`StarletteHTTPException`にリネームしています: ```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### **FastAPI** の例外ハンドラの再利用 { #reuse-fastapis-exception-handlers }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_src/handling_errors/tutorial004_py310.py
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) @app.exception_handler(RequestValidationError)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 920 bytes - Click Count (0) -
docs/ru/docs/tutorial/handling-errors.md
В данном примере, чтобы иметь возможность использовать оба `HTTPException` в одном коде, исключения Starlette переименованы в `StarletteHTTPException`: ```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### Переиспользование обработчиков исключений **FastAPI** { #reuse-fastapis-exception-handlers }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
Um in diesem Beispiel beide `HTTPException`s im selben Code zu haben, wird die Exception von Starlette zu `StarletteHTTPException` umbenannt: ```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### Die Exceptionhandler von **FastAPI** wiederverwenden { #reuse-fastapis-exception-handlers }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/es/docs/tutorial/handling-errors.md
En este ejemplo, para poder tener ambos `HTTPException` en el mismo código, las excepciones de Starlette son renombradas a `StarletteHTTPException`: ```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### Reutilizar los manejadores de excepciones de **FastAPI** { #reuse-fastapis-exception-handlers }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:15:55 GMT 2026 - 9.6K bytes - Click Count (0) -
docs/pt/docs/tutorial/handling-errors.md
Neste exemplo, para poder ter ambos os `HTTPException` no mesmo código, a exceção do Starlette é renomeada para `StarletteHTTPException`: ```Python from starlette.exceptions import HTTPException as StarletteHTTPException ``` ### Reutilize os manipuladores de exceção do **FastAPI** { #reuse-fastapis-exception-handlers }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:20:43 GMT 2026 - 10.1K bytes - Click Count (0)