Home / Class/ ValidationErrorLoggingRoute Class — fastapi Architecture

ValidationErrorLoggingRoute Class — fastapi Architecture

Architecture documentation for the ValidationErrorLoggingRoute class in tutorial002_py310.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  9fa3b0f3_cbec_fd46_c0db_5e7ae78f9fc4["ValidationErrorLoggingRoute"]
  aa28685f_bb97_e988_ff40_3e5385960f32["APIRoute"]
  9fa3b0f3_cbec_fd46_c0db_5e7ae78f9fc4 -->|extends| aa28685f_bb97_e988_ff40_3e5385960f32
  32cf0138_5dda_0a0d_8b8e_bf7910851ce9["tutorial002_py310.py"]
  9fa3b0f3_cbec_fd46_c0db_5e7ae78f9fc4 -->|defined in| 32cf0138_5dda_0a0d_8b8e_bf7910851ce9
  0308ef70_b277_44b2_97b2_8a07af42fe47["get_route_handler()"]
  9fa3b0f3_cbec_fd46_c0db_5e7ae78f9fc4 -->|method| 0308ef70_b277_44b2_97b2_8a07af42fe47

Relationship Graph

Source Code

docs_src/custom_request_and_route/tutorial002_py310.py lines 8–20

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:
                return await original_route_handler(request)
            except RequestValidationError as exc:
                body = await request.body()
                detail = {"errors": exc.errors(), "body": body.decode()}
                raise HTTPException(status_code=422, detail=detail)

        return custom_route_handler

Domain

Extends

Frequently Asked Questions

What is the ValidationErrorLoggingRoute class?
ValidationErrorLoggingRoute is a class in the fastapi codebase, defined in docs_src/custom_request_and_route/tutorial002_py310.py.
Where is ValidationErrorLoggingRoute defined?
ValidationErrorLoggingRoute is defined in docs_src/custom_request_and_route/tutorial002_py310.py at line 8.
What does ValidationErrorLoggingRoute extend?
ValidationErrorLoggingRoute extends APIRoute.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free