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

Function isCustom

ark/schema/shared/errors.ts:1100–1113  ·  view source on GitHub ↗
(error: ArkError)

Source from the content-addressed store, hash-verified

1098 * supplied where it was raised, rather than written from what it expected
1099 */
1100export const isCustom = (error: ArkError): boolean => {
1101 if (templated.has(error)) return false
1102 if (sharing.has(error)) return true
1103 const source = ErrorSource.of(error)
1104 let config: ResolvedConfig
1105 if (source instanceof Supplied) {
1106 if (source.input.message !== undefined) return !isInvalidInput(source.input)
1107 config = source.config
1108 } else config = source
1109 return (
1110 configuredMessageOf(error) !== undefined ||
1111 configuresMessage(config, error.code)
1112 )
1113}
1114
1115// whether each config writes every code's message as the default does, found
1116// once: nearly all do, and reading a code's writers from two configs for each

Callers 3

writeRelativeFunction · 0.70
isCustomErrorFunction · 0.70
errorLineOfFunction · 0.70

Calls 5

isInvalidInputFunction · 0.85
configuredMessageOfFunction · 0.85
configuresMessageFunction · 0.85
hasMethod · 0.45
ofMethod · 0.45

Tested by

no test coverage detected