Commit 82936b2 1 parent c2750a0 commit 82936b2 Copy full SHA for 82936b2
File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,10 @@ export class ZodError<T = any> extends Error {
285
285
}
286
286
287
287
/**
288
- * message returns the .issues field as a pretty-printed JSON string, NOT necessarily a human-readable message.
288
+ * message is a JSON.stringified issues array. This is an intentional decision
289
+ * to make the message property as informative as possible for logging, etc.
290
+ * You should use .issues to retrieve granular error information rather than
291
+ * JSON.parse(err.message).
289
292
*/
290
293
override get message ( ) {
291
294
return JSON . stringify ( this . issues , util . jsonStringifyReplacer , 2 ) ;
Original file line number Diff line number Diff line change @@ -285,7 +285,10 @@ export class ZodError<T = any> extends Error {
285
285
}
286
286
287
287
/**
288
- * message returns the .issues field as a pretty-printed JSON string, NOT necessarily a human-readable message.
288
+ * message is a JSON.stringified issues array. This is an intentional decision
289
+ * to make the message property as informative as possible for logging, etc.
290
+ * You should use .issues to retrieve granular error information rather than
291
+ * JSON.parse(err.message).
289
292
*/
290
293
override get message ( ) {
291
294
return JSON . stringify ( this . issues , util . jsonStringifyReplacer , 2 ) ;
You can’t perform that action at this time.
0 commit comments