Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 13 for StarletteHTTPException (0.16 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. docs/fr/docs/tutorial/handling-errors.md

    Dans cet exemple, afin de pouvoir avoir les deux `HTTPException` dans le même code, les exceptions de Starlette sont renommées en `StarletteHTTPException` :
    
    ```Python
    from starlette.exceptions import HTTPException as StarletteHTTPException
    ```
    
    ### Réutiliser les gestionnaires d'exception de **FastAPI** { #reuse-fastapis-exception-handlers }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:37:13 GMT 2026
    - 10K bytes
    - Click Count (0)
  9. docs/uk/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 18:27:41 GMT 2026
    - 13.9K bytes
    - Click Count (0)
  10. docs/tr/docs/tutorial/handling-errors.md

    Bu örnekte, iki `HTTPException`’ı da aynı kodda kullanabilmek için Starlette’in exception’ı `StarletteHTTPException` olarak yeniden adlandırılıyor:
    
    ```Python
    from starlette.exceptions import HTTPException as StarletteHTTPException
    ```
    
    ### **FastAPI**’nin Exception Handler’larını Yeniden Kullanmak { #reuse-fastapis-exception-handlers }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 07:53:17 GMT 2026
    - 9.7K bytes
    - Click Count (0)
Back to Top