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

Function catch

packages/zod/src/v3/types.ts:503–512  ·  view source on GitHub ↗
(def: any)

Source from the content-addressed store, hash-verified

501 catch(def: Output): ZodCatch<this>;
502 catch(def: (ctx: { error: ZodError; input: Input }) => Output): ZodCatch<this>;
503 catch(def: any) {
504 const catchValueFunc = typeof def === "function" ? def : () => def;
505
506 return new ZodCatch({
507 ...processCreateParams(this._def),
508 innerType: this,
509 catchValue: catchValueFunc,
510 typeName: ZodFirstPartyTypeKind.ZodCatch,
511 }) as any;
512 }
513
514 describe(description: string): this {
515 const This = (this as any).constructor;

Callers

nothing calls this directly

Calls 1

processCreateParamsFunction · 0.85

Tested by

no test coverage detected