mirror of
https://github.com/morluto/rea.git
synced 2026-10-31 20:06:14 +00:00
Parse caller selections and authenticated Evidence at their owners, reuse the parsed function and comparison facts, and preserve unexpected implementation failures. Remove downstream error guessing and redundant validation wrappers. Verify with 526 affected tests, source checks, docs conformance, test discovery and duplication checks. Seven public SDK regressions fail on the main baseline. No real-provider execution was performed.
14 lines
593 B
TypeScript
14 lines
593 B
TypeScript
import { z } from "zod";
|
|
|
|
/** Locate the first schema issue, or keep a thrown constraint message. */
|
|
export const describeValidationFailure = (cause: unknown): string => {
|
|
if (!(cause instanceof z.ZodError))
|
|
return cause instanceof Error ? cause.message : String(cause);
|
|
const [first, ...rest] = cause.issues;
|
|
const location =
|
|
first === undefined || first.path.length === 0
|
|
? "the document root"
|
|
: first.path.map(String).join(".");
|
|
return `at ${location}: ${first?.message ?? "invalid value"}${rest.length === 0 ? "" : ` (${String(rest.length)} more issues)`}`;
|
|
};
|