Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 33 for exception_handlers (0.08 sec)

  1. fastapi/applications.py

            )
            self.exception_handlers: dict[
                Any, Callable[[Request, Any], Union[Response, Awaitable[Response]]]
            ] = {} if exception_handlers is None else dict(exception_handlers)
            self.exception_handlers.setdefault(HTTPException, http_exception_handler)
            self.exception_handlers.setdefault(
                RequestValidationError, request_validation_exception_handler
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 176.3K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/handling-errors.md

    If you want to use the exception along with the same default exception handlers from  **FastAPI**, you can import and reuse the default exception handlers from `fastapi.exception_handlers`:
    
    {* ../../docs_src/handling_errors/tutorial006_py39.py hl[2:5,15,21] *}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 9K bytes
    - Viewed (0)
  3. docs/ja/docs/tutorial/handling-errors.md

    ```Python
    from starlette.exceptions import HTTPException as StarletteHTTPException
    ```
    
    ### **FastAPI** の例外ハンドラの再利用
    
    また、何らかの方法で例外を使用することもできますが、**FastAPI** から同じデフォルトの例外ハンドラを使用することもできます。
    
    デフォルトの例外ハンドラを`fastapi.exception_handlers`からインポートして再利用することができます:
    
    {* ../../docs_src/handling_errors/tutorial006.py hl[2,3,4,5,15,21] *}
    
    この例では、非常に表現力のあるメッセージでエラーを`print`しています。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 11.6K bytes
    - Viewed (0)
  4. impl/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java

     * under the License.
     */
    package org.apache.maven.exception;
    
    /**
     * Transform an exception into useful end-user message.
     *
     * @since 3.0-alpha-3
     */
    public interface ExceptionHandler {
        ExceptionSummary handleException(Throwable e);
    Registered: Sun Dec 28 03:35:09 UTC 2025
    - Last Modified: Fri Oct 25 12:31:46 UTC 2024
    - 1023 bytes
    - Viewed (0)
  5. tests/test_validation_error_context.py

    app.mount(path="/sub", app=sub_app)
    
    
    @app.exception_handler(RequestValidationError)
    @sub_app.exception_handler(RequestValidationError)
    async def request_validation_handler(request: Request, exc: RequestValidationError):
        captured_exception.capture(exc)
        raise exc
    
    
    @app.exception_handler(ResponseValidationError)
    @sub_app.exception_handler(ResponseValidationError)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 06 12:21:57 UTC 2025
    - 4.7K bytes
    - Viewed (0)
  6. docs_src/handling_errors/tutorial004_py39.py

    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)
    async def validation_exception_handler(request, exc: RequestValidationError):
        message = "Validation errors:"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 920 bytes
    - Viewed (0)
  7. impl/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorSubModulesTest.java

        @Inject
        private LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer;
    
        @Inject
        private LifecycleTaskSegmentCalculator lifeCycleTaskSegmentCalculator;
    
        @Inject
        private ExceptionHandler exceptionHandler;
    
        protected String getProjectsDirectory() {
            return "src/test/projects/lifecycle-executor";
        }
    
        @Test
        void testCreation() throws Exception {
    Registered: Sun Dec 28 03:35:09 UTC 2025
    - Last Modified: Fri Oct 25 12:31:46 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  8. docs_src/handling_errors/tutorial003_py39.py

    from fastapi import FastAPI, Request
    from fastapi.responses import JSONResponse
    
    
    class UnicornException(Exception):
        def __init__(self, name: str):
            self.name = name
    
    
    app = FastAPI()
    
    
    @app.exception_handler(UnicornException)
    async def unicorn_exception_handler(request: Request, exc: UnicornException):
        return JSONResponse(
            status_code=418,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 626 bytes
    - Viewed (0)
  9. docs_src/handling_errors/tutorial005_py39.py

    from fastapi.encoders import jsonable_encoder
    from fastapi.exceptions import RequestValidationError
    from fastapi.responses import JSONResponse
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    @app.exception_handler(RequestValidationError)
    async def validation_exception_handler(request: Request, exc: RequestValidationError):
        return JSONResponse(
            status_code=422,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 626 bytes
    - Viewed (0)
  10. impl/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java

            MojoExecutionException mojoEx =
                    new MojoExecutionException("Error executing Jetty: Unable to establish loopback connection", ioEx);
    
            ExceptionHandler exceptionHandler = new DefaultExceptionHandler();
            ExceptionSummary exceptionSummary = exceptionHandler.handleException(mojoEx);
    
            String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/ConnectException";
    Registered: Sun Dec 28 03:35:09 UTC 2025
    - Last Modified: Fri Oct 25 12:31:46 UTC 2024
    - 6.3K bytes
    - Viewed (0)
Back to top