- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 101 for exceptions (0.16 sec)
-
docs/em/docs/tutorial/handling-errors.md
``` ## โ ๐ โ ๐โ๐ฆบ ๐ ๐ช ๐ฎ ๐ โ ๐โ๐ฆบ โฎ๏ธ <a href="https://www.starlette.io/exceptions/" class="external-link" target="_blank">๐ โ ๐ โช๏ธโก๏ธ ๐</a>. โก๏ธ ๐ฌ ๐ โ๏ธ ๐ โ `UnicornException` ๐ ๐ (โ๏ธ ๐ ๐ โ๏ธ) ๐ช `raise`. & ๐ ๐ ๐ต ๐ โ ๐ โฎ๏ธ FastAPI. ๐ ๐ช ๐ฎ ๐ โ ๐โ๐ฆบ โฎ๏ธ `@app.exception_handler()`: ```Python hl_lines="5-7 13-18 24" {!../../../docs_src/handling_errors/tutorial003.py!} ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 8.3K bytes - Viewed (0) -
docs_src/custom_request_and_route/tutorial002.py
from typing import Callable, List from fastapi import Body, FastAPI, HTTPException, Request, Response from fastapi.exceptions import RequestValidationError from fastapi.routing import APIRoute class ValidationErrorLoggingRoute(APIRoute): def get_route_handler(self) -> Callable: original_route_handler = super().get_route_handler() async def custom_route_handler(request: Request) -> Response: try:
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 932 bytes - Viewed (0) -
tests/test_exception_handlers.py
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) @app.get("/http-exception") def route_with_http_exception():
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Feb 17 12:40:12 GMT 2022 - 1.9K bytes - Viewed (0) -
fastapi/exception_handlers.py
from fastapi.encoders import jsonable_encoder from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError from fastapi.utils import is_body_allowed_for_status_code from fastapi.websockets import WebSocket from starlette.exceptions import HTTPException from starlette.requests import Request from starlette.responses import JSONResponse, Response from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY, WS_1008_POLICY_VIOLATION
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sun Jun 11 19:08:14 GMT 2023 - 1.3K bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial008d.py
) def test_internal_server_error(): from docs_src.dependencies.tutorial008d import app client = TestClient(app, raise_server_exceptions=False) response = client.get("/items/portal-gun") assert response.status_code == 500, response.text
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 1.2K bytes - Viewed (0) -
tests/test_starlette_exception.py
) return {"item": items[item_id]} @app.get("/http-no-body-statuscode-exception") async def no_body_status_code_exception(): raise HTTPException(status_code=204) @app.get("/http-no-body-statuscode-with-detail-exception") async def no_body_status_code_with_detail_exception(): raise HTTPException(status_code=204, detail="I should just disappear!") @app.get("/starlette-items/{item_id}")
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jun 30 18:25:16 GMT 2023 - 7.4K bytes - Viewed (0) -
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) -
docs_src/handling_errors/tutorial004.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)
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Mar 26 19:09:53 GMT 2020 - 762 bytes - Viewed (0) -
fastapi/utils.py
"alias": alias, } ) try: return ModelField(**kwargs) # type: ignore[arg-type] except (RuntimeError, PydanticSchemaGenerationError): raise fastapi.exceptions.FastAPIError( "Invalid args for response field! Hint: " f"check that {type_} is a valid Pydantic field type. " "If you are using a return type annotation that is not a valid Pydantic "
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 7.8K bytes - Viewed (0) -
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)