Home / Class/ ValidationErrorLoggingRoute Class — fastapi Architecture

ValidationErrorLoggingRoute Class — fastapi Architecture

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

Entity Profile

Dependency Diagram

graph TD
  fff150ab_16a5_8129_4f06_78ef495f4b62["ValidationErrorLoggingRoute"]
  aa28685f_bb97_e988_ff40_3e5385960f32["APIRoute"]
  fff150ab_16a5_8129_4f06_78ef495f4b62 -->|extends| aa28685f_bb97_e988_ff40_3e5385960f32
  7731c2d6_c29d_81ef_2e87_a0fd77fe47c8["tutorial002_py39.py"]
  fff150ab_16a5_8129_4f06_78ef495f4b62 -->|defined in| 7731c2d6_c29d_81ef_2e87_a0fd77fe47c8
  f2739951_2560_ea29_2557_30af1b47317b["get_route_handler()"]
  fff150ab_16a5_8129_4f06_78ef495f4b62 -->|method| f2739951_2560_ea29_2557_30af1b47317b

Relationship Graph

Source Code

docs_src/custom_request_and_route/tutorial002_py39.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_py39.py.
Where is ValidationErrorLoggingRoute defined?
ValidationErrorLoggingRoute is defined in docs_src/custom_request_and_route/tutorial002_py39.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