generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 176
Closed as duplicate of#4375
Labels
not-a-bugNew and existing bug reports incorrectly submitted as bugNew and existing bug reports incorrectly submitted as bug
Description
Expected Behavior
When a ParseError is thrown by the parse function, the cause field is a ZodError.
Current Behavior
When a ParseError is thrown by the parse function, the cause field is an array of ZodIssues.
Code snippet
Pre v2.24.0:
try {
return schema.parse(data);
} catch (error) {
throw new ParseError('Failed to parse schema', { cause: error as Error });
}Post v2.24.0
if (result.issues) {
const error = new ParseError('Failed to parse schema', {
cause: result.issues,
});
...Steps to Reproduce
- Call
parserpre and post v2.24.0 with an invalid schema - Check the error thrown has two different
cause
Possible Solution
Keep backward compatibility by creating a ZodError from the issues or create a breaking change with version bump.
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
22.x
Packaging format used
npm
Execution logs
Metadata
Metadata
Assignees
Labels
not-a-bugNew and existing bug reports incorrectly submitted as bugNew and existing bug reports incorrectly submitted as bug
Type
Projects
Status
Closed