0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-24 23:21:57 -05:00

Actions: include zod error in message for easier debugging (#11029)

* refactor: embed zod object in error msg

* chore: changeset
This commit is contained in:
Ben Holmes 2024-05-13 15:28:48 -04:00 committed by GitHub
parent 8dfb1a23cc
commit bd34452a34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Actions: include validation error in thrown error message for debugging.

View file

@ -110,7 +110,7 @@ export class ActionInputError<T extends ErrorInferenceObject> extends ActionErro
fields: z.ZodError<T>['formErrors']['fieldErrors'];
constructor(issues: z.ZodIssue[]) {
super({ message: 'Failed to validate', code: 'BAD_REQUEST' });
super({ message: `Failed to validate: ${JSON.stringify(issues, null, 2)}`, code: 'BAD_REQUEST' });
this.issues = issues;
this.fields = {};
for (const issue of issues) {