MCPcopy
hub / github.com/colinhacks/zod / initializer

Function initializer

packages/zod/src/v4/core/errors.ts:230–246  ·  view source on GitHub ↗
(inst: $ZodError, def: $ZodIssue[])

Source from the content-addressed store, hash-verified

228}
229
230const 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
248export const $ZodError: $constructor<$ZodError> = $constructor("$ZodError", initializer);
249interface $ZodRealError<T = any> extends $ZodError<T> {}

Callers 1

initFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected