Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 2,892 for exception (0.27 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_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)
  3. 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)
  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. android/guava-tests/test/com/google/common/io/CloserTest.java

      public void testCloseExceptionsSuppressed_whenExceptionThrownFromTryBlock() throws IOException {
        Closer closer = new Closer(suppressor);
    
        IOException tryException = new IOException();
        IOException c1Exception = new IOException();
        IOException c2Exception = new IOException();
    
        TestCloseable c1 = closer.register(TestCloseable.throwsOnClose(c1Exception));
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Mar 06 15:15:46 GMT 2024
    - 13.6K bytes
    - Viewed (0)
  6. 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)
  7. guava-tests/test/com/google/common/io/CloserTest.java

      public void testCloseExceptionsSuppressed_whenExceptionThrownFromTryBlock() throws IOException {
        Closer closer = new Closer(suppressor);
    
        IOException tryException = new IOException();
        IOException c1Exception = new IOException();
        IOException c2Exception = new IOException();
    
        TestCloseable c1 = closer.register(TestCloseable.throwsOnClose(c1Exception));
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Mar 06 15:15:46 GMT 2024
    - 13.6K bytes
    - Viewed (0)
  8. 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)
  9. docs/en/docs/reference/exceptions.md

    # Exceptions - `HTTPException` and `WebSocketException`
    
    These are the exceptions that you can raise to show errors to the client.
    
    When you raise an exception, as would happen with normal Python, the rest of the execution is aborted. This way you can raise these exceptions from anywhere in the code to abort a request and show the error to the client.
    
    You can use:
    
    * `HTTPException`
    * `WebSocketException`
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 597 bytes
    - Viewed (0)
  10. android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java

        }
      }
    
      /**
       * Different exceptions happening on multiple futures with the same cause should not be logged.
       */
      public void testAllAsList_logging_same_cause() throws Exception {
        try {
          MyException exception1 = new MyException();
          MyException exception2 = new MyException();
          MyException exception3 = new MyException();
    
          MyException sameInstance = new MyException();
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Feb 20 17:00:05 GMT 2024
    - 144.5K bytes
    - Viewed (0)
Back to top