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

Function extractValidationIssues

apps/sim/lib/api/client/errors.ts:65–84  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

63 * callers can fall back to toast/log paths.
64 */
65export function extractValidationIssues(error: unknown): ValidationIssue[] {
66 if (!error || typeof error !== 'object') return []
67
68 if (isApiClientError(error)) {
69 const body = error.body
70 if (body && typeof body === 'object') {
71 const details = (body as { details?: unknown }).details
72 if (Array.isArray(details)) {
73 return details.map(normalizeIssue).filter((i): i is ValidationIssue => i !== null)
74 }
75 }
76 return []
77 }
78
79 const issues = (error as { issues?: unknown }).issues
80 if (Array.isArray(issues)) {
81 return issues.map(normalizeIssue).filter((i): i is ValidationIssue => i !== null)
82 }
83 return []
84}
85
86/**
87 * Match a single issue by suffix path. `pathSuffix` lets callers ignore the

Callers 2

findValidationIssueFunction · 0.85
isValidationErrorFunction · 0.85

Calls 1

isApiClientErrorFunction · 0.85

Tested by

no test coverage detected