Skip to content

Commit bd34452

Browse files
authoredMay 13, 2024··
Actions: include zod error in message for easier debugging (#11029)
* refactor: embed zod object in error msg * chore: changeset
1 parent 8dfb1a2 commit bd34452

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎.changeset/modern-donkeys-taste.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"astro": patch
3+
---
4+
5+
Actions: include validation error in thrown error message for debugging.

‎packages/astro/src/actions/runtime/virtual/shared.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class ActionInputError<T extends ErrorInferenceObject> extends ActionErro
110110
fields: z.ZodError<T>['formErrors']['fieldErrors'];
111111

112112
constructor(issues: z.ZodIssue[]) {
113-
super({ message: 'Failed to validate', code: 'BAD_REQUEST' });
113+
super({ message: `Failed to validate: ${JSON.stringify(issues, null, 2)}`, code: 'BAD_REQUEST' });
114114
this.issues = issues;
115115
this.fields = {};
116116
for (const issue of issues) {

0 commit comments

Comments
 (0)
Please sign in to comment.