MCPcopy Index your code
hub / github.com/simstudioai/sim / findValidationIssue

Function findValidationIssue

apps/sim/lib/api/client/errors.ts:91–102  ·  view source on GitHub ↗
(
  error: unknown,
  pathSuffix: ReadonlyArray<string | number>
)

Source from the content-addressed store, hash-verified

89 * `path: ['name']` and `path: ['updates', 'name']`.
90 */
91export function findValidationIssue(
92 error: unknown,
93 pathSuffix: ReadonlyArray<string | number>
94): ValidationIssue | null {
95 const issues = extractValidationIssues(error)
96 for (const issue of issues) {
97 if (issue.path.length < pathSuffix.length) continue
98 const tail = issue.path.slice(issue.path.length - pathSuffix.length)
99 if (tail.every((segment, i) => segment === pathSuffix[i])) return issue
100 }
101 return null
102}
103
104/** True when the error is a recognised validation failure (client or server). */
105export function isValidationError(error: unknown): boolean {

Callers 2

handleSaveFunction · 0.90
handleSaveFunction · 0.90

Calls 1

extractValidationIssuesFunction · 0.85

Tested by

no test coverage detected