| 228 | } |
| 229 | |
| 230 | const initializer = (inst: $ZodError, def: $ZodIssue[]): void => { |
| 231 | inst.name = "$ZodError"; |
| 232 | Object.defineProperty(inst, "_zod", { |
| 233 | value: inst._zod, |
| 234 | enumerable: false, |
| 235 | }); |
| 236 | Object.defineProperty(inst, "issues", { |
| 237 | value: def, |
| 238 | enumerable: false, |
| 239 | }); |
| 240 | inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2); |
| 241 | |
| 242 | Object.defineProperty(inst, "toString", { |
| 243 | value: () => inst.message, |
| 244 | enumerable: false, |
| 245 | }); |
| 246 | }; |
| 247 | |
| 248 | export const $ZodError: $constructor<$ZodError> = $constructor("$ZodError", initializer); |
| 249 | interface $ZodRealError<T = any> extends $ZodError<T> {} |