MCPcopy Create free account
hub / github.com/Effect-TS/effect / findMessage

Function findMessage

packages/effect/src/SchemaIssue.ts:1461–1478  ·  view source on GitHub ↗
(issue: Issue)

Source from the content-addressed store, hash-verified

1459}
1460
1461function findMessage(issue: Issue): string | undefined {
1462 // A Composite's ast describes the whole schema, not the failures it groups.
1463 if (issue._tag === "Pointer" || issue._tag === "Composite") return
1464 if (issue._tag === "Encoding") return findMessage(issue.issue)
1465 const annotations = issue._tag === "Filter"
1466 ? issue.filter.annotations
1467 : "annotations" in issue
1468 ? issue.annotations
1469 : issue.ast.annotations
1470 const message = annotations?.[
1471 issue._tag === "MissingKey"
1472 ? "messageMissingKey"
1473 : issue._tag === "UnexpectedKey"
1474 ? "messageUnexpectedKey"
1475 : "message"
1476 ]
1477 if (typeof message === "string") return message
1478}

Callers 4

defaultLeafHookFunction · 0.70
defaultCheckHookFunction · 0.70
toDefaultIssuesFunction · 0.70
formatIssueFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected