Closed
Description
Expected Behaviour
The exception handling functionality should work when data validation is enabled, including when the validation fails.
Current Behaviour
The exception handler is not called
Code snippet
app = APIGatewayRestResolver(enable_validation=True)
@app.exception_handler(RequestValidationError)
def handle_invalid_data(ex: RequestValidationError):
return Response(
status_code=422,
content_type=content_types.TEXT_PLAIN,
body="Invalid request parameters.",
)
Possible Solution
No response
Steps to Reproduce
- Use the code snippet above
- Send a request that fails validation
- The exception handler is not called
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.7
Packaging format used
PyPi
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped