Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,983 for Exception (0.19 sec)

  1. fastapi/exception_handlers.py

    async def http_exception_handler(request: Request, exc: HTTPException) -> Response:
        headers = getattr(exc, "headers", None)
        if not is_body_allowed_for_status_code(exc.status_code):
            return Response(status_code=exc.status_code, headers=headers)
        return JSONResponse(
            {"detail": exc.detail}, status_code=exc.status_code, headers=headers
        )
    
    
    async def request_validation_exception_handler(
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 1.3K bytes
    - Viewed (0)
  2. 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 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.4K bytes
    - Viewed (0)
  3. 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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Feb 17 12:40:12 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  4. tests/test_custom_middleware_exception.py

        return {"message": "OK"}
    
    
    app.include_router(router)
    app.add_middleware(ContentSizeLimitMiddleware, max_content_size=2**8)
    
    
    client = TestClient(app)
    
    
    def test_custom_middleware_exception(tmp_path: Path):
        default_pydantic_max_size = 2**16
        path = tmp_path / "test.txt"
        path.write_bytes(b"x" * (default_pydantic_max_size + 1))
    
        with client:
            with open(path, "rb") as file:
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Aug 25 21:44:40 GMT 2022
    - 2.8K bytes
    - Viewed (0)
  5. docs/de/docs/reference/exceptions.md

    # Exceptions – `HTTPException` und `WebSocketException`
    
    Dies sind die <abbr title="Exception – Ausnahme, Fehler: Python-Objekt, das einen Fehler nebst Metadaten repräsentiert">Exceptions</abbr>, die Sie auslösen können, um dem Client Fehler zu berichten.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:16:53 GMT 2024
    - 797 bytes
    - Viewed (0)
  6. fastapi/exceptions.py

    from pydantic import BaseModel, create_model
    from starlette.exceptions import HTTPException as StarletteHTTPException
    from starlette.exceptions import WebSocketException as StarletteWebSocketException
    from typing_extensions import Annotated, Doc
    
    
    class HTTPException(StarletteHTTPException):
        """
        An HTTP exception you can raise in your own code to show errors to the client.
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 4.9K bytes
    - Viewed (0)
  7. android/guava/src/com/google/common/io/Closer.java

     *       will be thrown.
     *   <li>If no exceptions or errors were thrown in the try block, the <i>first</i> exception thrown
     *       by an attempt to close a resource will be thrown.
     *   <li>Any exception caught when attempting to close a resource that is <i>not</i> thrown (because
     *       another exception is already being thrown) is <i>suppressed</i>.
     * </ul>
     *
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Mar 06 15:15:46 GMT 2024
    - 11.9K bytes
    - Viewed (0)
  8. docs_src/handling_errors/tutorial006.py

    from fastapi import FastAPI, HTTPException
    from fastapi.exception_handlers import (
        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)}")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 11:10:33 GMT 2020
    - 928 bytes
    - Viewed (0)
  9. android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java

      public void testImmediateFailedFuture() throws Exception {
        Exception exception = new Exception();
        ListenableFuture<String> future = immediateFailedFuture(exception);
        assertThat(future.toString()).endsWith("[status=FAILURE, cause=[" + exception + "]]");
    
        try {
          getDone(future);
          fail();
        } catch (ExecutionException expected) {
          assertSame(exception, expected.getCause());
        }
    
        try {
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Tue Feb 20 17:00:05 GMT 2024
    - 144.5K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/util/concurrent/Futures.java

       * @param exceptionType the exception type that triggers use of {@code fallback}. The exception
       *     type is matched against the input's exception. "The input's exception" means the cause of
       *     the {@link ExecutionException} thrown by {@code input.get()} or, if {@code get()} throws a
       *     different kind of exception, that exception itself. To avoid hiding bugs and other
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Apr 01 16:15:01 GMT 2024
    - 59.6K bytes
    - Viewed (0)
Back to top