[zod-nestjs]: Implement Custom Exception Class for Zod Validation Failures
JunyaIizuka opened this issue · 4 comments
I would like to propose the implementation of a dedicated custom exception class for exceptions thrown when Zod validation fails.
Currently, a generic BadRequestException is being thrown, which does not allow us to distinguish whether the failure was due to Zod validation or other causes.
Having a specific custom exception class for Zod validation errors would greatly enhance error handling and debugging processes.
How would it work on this module? The one referenced is deprecated
It would be nice to have a custom exception class with access to the original values and full parse result.
To detect validation errors in my interceptor, I currently set the errorHttpStatusCode
to 418 in the ZodValidationPipe
🫖