Skip to content
New issue

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

Allow handling validation errors #140

Closed
lnogol opened this issue Feb 10, 2023 · 3 comments
Closed

Allow handling validation errors #140

lnogol opened this issue Feb 10, 2023 · 3 comments

Comments

@lnogol
Copy link

lnogol commented Feb 10, 2023

Zodios currently sends a response when validation fails:

return res.status(400).json({ ... });

This is fine by default, but it should also allow to handle the error manually in express error handler by calling next(err) instead.

Perhaps as a toggle passed to .app() and exporting isZodiosValidationError(err)

@ecyrbe
Copy link
Owner

ecyrbe commented Feb 10, 2023

Hello @lnogol ,

Indeed, completely agree. Maybe even better, always call next(err) and expose a default error handler you can plug and this way, let you choose if you want to use it or use your own.

@stale
Copy link

stale bot commented Mar 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 12, 2023
@stale stale bot closed this as completed Mar 19, 2023
@ecyrbe ecyrbe reopened this Mar 19, 2023
@stale stale bot removed the wontfix This will not be worked on label Mar 19, 2023
@ecyrbe
Copy link
Owner

ecyrbe commented Apr 3, 2023

@dwidge just implemented this. and is available in v10.6.0

@ecyrbe ecyrbe closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants