Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 27 for exceptions (0.15 sec)

  1. 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 May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.8K bytes
    - Viewed (0)
  2. fastapi/security/http.py

    import binascii
    from base64 import b64decode
    from typing import Optional
    
    from fastapi.exceptions import HTTPException
    from fastapi.openapi.models import HTTPBase as HTTPBaseModel
    from fastapi.openapi.models import HTTPBearer as HTTPBearerModel
    from fastapi.security.base import SecurityBase
    from fastapi.security.utils import get_authorization_scheme_param
    from pydantic import BaseModel
    from starlette.requests import Request
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_body/test_tutorial001_py310.py

                        "type": "type_error.dict",
                    }
                ]
            }
        )
    
    
    @needs_py310
    def test_other_exceptions(client: TestClient):
        with patch("json.loads", side_effect=Exception):
            response = client.post("/items/", json={"test": "test2"})
            assert response.status_code == 400, response.text
    
    
    @needs_py310
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 15K bytes
    - Viewed (2)
  4. tests/test_tutorial/test_body/test_tutorial001.py

                        "type": "type_error.dict",
                    }
                ]
            }
        )
    
    
    def test_other_exceptions(client: TestClient):
        with patch("json.loads", side_effect=Exception):
            response = client.post("/items/", json={"test": "test2"})
            assert response.status_code == 400, response.text
    
    
    def test_openapi_schema(client: TestClient):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 14.7K bytes
    - Viewed (7)
  5. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

        ```
    
    An alternative you could use to catch exceptions (and possibly also raise another `HTTPException`) is to create a [Custom Exception Handler](../handling-errors.md#install-custom-exception-handlers){.internal-link target=_blank}.
    
    ## Dependencies with `yield` and `except`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  6. docs/de/docs/tutorial/dependencies/dependencies-with-yield.md

        opt Löst aus
            operation -->> dep: Löst Exception aus (z. B. HTTPException)
            opt Handhabt
                dep -->> dep: Kann Exception abfangen, eine neue HTTPException auslösen, andere Exceptions auslösen
                dep -->> handler: Leitet Exception automatisch weiter
            end
            handler -->> client: HTTP-Error-Response
        end
        operation ->> client: Sendet Response an Client
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:10:29 GMT 2024
    - 13.5K bytes
    - Viewed (0)
  7. fastapi/security/oauth2.py

    from typing import Any, Dict, List, Optional, Union, cast
    
    from fastapi.exceptions import HTTPException
    from fastapi.openapi.models import OAuth2 as OAuth2Model
    from fastapi.openapi.models import OAuthFlows as OAuthFlowsModel
    from fastapi.param_functions import Form
    from fastapi.security.base import SecurityBase
    from fastapi.security.utils import get_authorization_scheme_param
    from starlette.requests import Request
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  8. 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 May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:28:29 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  9. docs/em/docs/contributing.md

    ▶️ ✍ 👑 📃, `docs/ht/index.md`.
    
    ⤴️ 👆 💪 😣 ⏮️ ⏮️ 👩‍🌾, "♻ 🇪🇸".
    
    ##### 🆕 🇪🇸 🚫 🐕‍🦺
    
    🚥 🕐❔ 🏃‍♂ 🖖 💽 ✍ 👆 🤚 ❌ 🔃 🇪🇸 🚫 ➖ 🐕‍🦺, 🕳 💖:
    
    ```
     raise TemplateNotFound(template)
    jinja2.exceptions.TemplateNotFound: partials/language/xx.html
    ```
    
    👈 ⛓ 👈 🎢 🚫 🐕‍🦺 👈 🇪🇸 (👉 💼, ⏮️ ❌ 2️⃣-🔤 📟 `xx`).
    
    ✋️ 🚫 😟, 👆 💪 ⚒ 🎢 🇪🇸 🇪🇸 &amp; ⤴️ 💬 🎚 🩺.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Jun 11 21:38:15 GMT 2023
    - 11.4K bytes
    - Viewed (0)
  10. tests/test_dependency_contextmanager.py

        "bg": "not set",
        "sync_bg": "not set",
    }
    
    errors = []
    
    
    async def get_state():
        return state
    
    
    class AsyncDependencyError(Exception):
        pass
    
    
    class SyncDependencyError(Exception):
        pass
    
    
    class OtherDependencyError(Exception):
        pass
    
    
    async def asyncgen_state(state: Dict[str, str] = Depends(get_state)):
        state["/async"] = "asyncgen started"
        yield state["/async"]
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 11.6K bytes
    - Viewed (0)
Back to top