-
Notifications
You must be signed in to change notification settings - Fork 146
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
Feature request: add custom Error for envelopes #1822
Comments
Revisiting this after a few months since the last interaction. So far, most likely due to the utility being in beta, there hasn't been much demand for this. We'll check back in a few months to see if things have changed, in the meanwhile Zod might have launched its next major version which is expected to include changes to the errors API. |
As part of a bug bash and refactoring of envelopes we have been making it so errors thrown by any of the envelopes are new ParseError('Failed to parse API Gateway body', {
cause: new ZodError([
{
code: 'invalid_type',
expected: 'string',
received: 'undefined',
path: ['path'],
message: 'Required',
},
{
code: 'invalid_type',
expected: 'object',
received: 'null',
path: ['body'],
message: 'Expected object, received null',
},
]),
}) With this in mind, I'm closing the issue as completed since we have improved on the previous DX. If anyone reads this issue in the future and would like to propose further improvements or changes to how we enhance Zod errors, please feel free to open a discussion. |
This issue is now closed. Please be mindful that future comments are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so. |
Use case
When parsing custom schema in the envelope we currently propagate any error from zod back to the user. When there is an error, the mental process is first to localise it between envelope or custom schema. We should provide a custom Error that clearly points out which part of the structure is invalid. This will allow to faster resolution of the error.
Solution/User Experience
No solution yet.
Alternative solutions
No response
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: