Feature request: Custom error responses for hono/validator
See original GitHub issueCurrently, when using the validator middleware, there’s no (nice) way of providing your own error responses when the request passes validation, resulting in a plaintext response that looks something like Invalid Value: the JSON body "name" is invalid - undefined
. This isn’t ideal for an API where the main format is JSON.
This feature request is to allow people to deal with formatting the error themselves.
Issue Analytics
- State:
- Created a year ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Validation custom error messages #1739 - Vincit/objection.js
I've tried it myself to integrate it - but failed miserably. It should tho not be so hard, based on Ajv-errors documentation: var...
Read more >Generating custom error responses - Amazon CloudFront
Generate a custom error response when CloudFront can't deliver requested content.
Read more >How To Implement Custom Error Responses in Express - Auth0
Learn why you may need custom error responses on 4xx errors, what a good custom format looks like, and how to apply it...
Read more >Custom Error Responses - Apache HTTP Server Version 2.4
Customized error responses can be defined for any HTTP status code designated as an error condition - that is, any 4xx or 5xx...
Read more >Custom error responses (beta) · Cloudflare Rules docs
Create rules that adjust incoming requests, change Cloudflare settings, or trigger actions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi! I have a few ideas on this matter. Please wait a moment, as I will introduce them later.
Hi @ThatOneBro !
Exactly. I am thinking the same thing and implementing it. For example, the result objects might look like this: