#How do I get Pydantic's error data in exception handlers?

1 messages · Page 1 of 1 (latest)

dull anvil
#

I want to send custom messages for input validation errors. To do this in Pydantic, we have to check the type in the error dict and create a custom message.
In ValidationException, I only get the error message and the details are lost. Is there any way to access the Pydantic error object in an exception handler?
Related github issue: https://github.com/litestar-org/litestar/issues/3466 (Not sure if this is the best solution)

sonic mothBOT
#
Notes for How do I get Pydantic's error data in exception handlers?
At your assistance

@dull anvil

No Response?

If no response in a reasonable time, ping @Member.

Closing

To close, type !solve or byte solve.

MCVE

Please include an MCVE so that we can reproduce your issue locally.