MCPcopy Create free account
hub / github.com/arktypeio/arktype / asLabeled

Function asLabeled

ark/schema/shared/errors.ts:1085–1094  ·  view source on GitHub ↗
(
	error: error,
	label: string
)

Source from the content-addressed store, hash-verified

1083 * writes it as it does its own labeled errors
1084 */
1085export const asLabeled = <error extends ArkIssue>(
1086 error: error,
1087 label: string
1088): error => {
1089 if (isArkError(error)) templated.add(error)
1090 labeledIssue(error, label)
1091 const unlabeled = error.message?.slice(label.length + 1)
1092 if (unlabeled?.startsWith("must be ")) error.expected = unlabeled.slice(8)
1093 return error
1094}
1095
1096/**
1097 * @internal whether an error's message was configured for its Type or code or

Callers 1

validateFunction · 0.90

Calls 3

labeledIssueFunction · 0.90
isArkErrorFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected