-
-
Notifications
You must be signed in to change notification settings - Fork 438
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
Validator should throw error rather than return c.json({ success, message })
#1441
Comments
The app.post(
'/',
validator('json', (data, c) => {
if (!data.title) {
return c.json({
success: false
}, 400)
}
return {
title: data.title,
}
}),
(c) => {
return c.json({
success: true
}, 201)
}
) |
I see, thanks. Reopened the issue. |
+1 for this. It would be nice to catch validator errors from onError handler. |
Okay. We have to consider making it. But, it may be a breaking change. So will be included in the next major version "v4". Thanks! |
+1 |
What is the feature you are proposing?
Validator should throw error rather than
return c.json({ success, message })
So we can use onError handler to format and send the right response to the client.
The text was updated successfully, but these errors were encountered: