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

Function finalizeIssue

packages/zod/src/v4/core/util.ts:849–869  ·  view source on GitHub ↗
(
  iss: errors.$ZodRawIssue,
  ctx: schemas.ParseContextInternal | undefined,
  config: $ZodConfig
)

Source from the content-addressed store, hash-verified

847}
848
849export function finalizeIssue(
850 iss: errors.$ZodRawIssue,
851 ctx: schemas.ParseContextInternal | undefined,
852 config: $ZodConfig
853): errors.$ZodIssue {
854 const message = iss.message
855 ? iss.message
856 : (unwrapMessage(iss.inst?._zod.def?.error?.(iss as never)) ??
857 unwrapMessage(ctx?.error?.(iss as never)) ??
858 unwrapMessage(config.customError?.(iss)) ??
859 unwrapMessage(config.localeError?.(iss)) ??
860 "Invalid input");
861
862 const { inst: _inst, continue: _continue, input: _input, ...rest } = iss as any;
863 rest.path ??= [];
864 rest.message = message;
865 if (ctx?.reportInput) {
866 rest.input = _input;
867 }
868 return rest;
869}
870
871export function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown" {
872 if (input instanceof Set) return "set";

Callers

nothing calls this directly

Calls 2

unwrapMessageFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected