We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Originally posted by valentinoli October 10, 2023
@app.exception_handler(ValidationError) async def validation_exception_handler(request: Request, exc: ValidationError): return PlainTextResponse( str(exc), status_code=status.HTTP_500_INTERNAL_SERVER_ERROR )
I was trying to handle both RequestValidationError and ValidationError by writing a custom handler for ValidationError but that doesn't work.
RequestValidationError
ValidationError
The docs state that
RequestValidationError is a sub-class of Pydantic's ValidationError
However, looking at FastAPI source code reveals that this is not the case.
Linux
No response
0.101.0
2.1.1
3.11.3
The text was updated successfully, but these errors were encountered:
The documentation needs to be fixed. The RequestValidationError was a subclass of ValidationError before 0.100.0 - it's not the case anymore.
Sorry, something went wrong.
Duplicate of #10424 😉
Ah. I forgot. Thanks.
Deleted the problematic line about RequestValidationError being a sub…
328a991
…class of Pydantic ValidationError, according to issue fastapi#10786
No branches or pull requests
Discussed in #10421
Originally posted by valentinoli October 10, 2023
First Check
Commit to Help
Example Code
Description
I was trying to handle both
RequestValidationError
andValidationError
by writing a custom handler forValidationError
but that doesn't work.The docs state that
However, looking at FastAPI source code reveals that this is not the case.
Operating System
Linux
Operating System Details
No response
FastAPI Version
0.101.0
Pydantic Version
2.1.1
Python Version
3.11.3
Additional Context
No response
The text was updated successfully, but these errors were encountered: