Replies: 1 comment
-
|
Fastify, thanks to #4554 already is handling that in a standardized way across its errors. Lines 135 to 139 in ec17333 Which is in fact the validation step, that you're making an example of. I'll create an issue for that |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
let's say we have this sample code.
in case of validation error, the response body would be like this:
{ "statusCode": 400, "error": "Bad Request", "message": "body must have required property 'foo'" }but in case of throwing my custom error, the response body would be like this:
{ "statusCode": 400, "code": "MY_CUSTOM_ERROR" "error": "Bad Request", "message": "description" }as you can see,
codekey is not available in framework level errors.this behavior is already confused our front-end developers and i'm kinda agree with them.
what's is your suggestion? I think we could add
codekey on every framework level errorsBeta Was this translation helpful? Give feedback.
All reactions