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

Function extractVantaError

apps/sim/tools/vanta/utils.ts:107–121  ·  view source on GitHub ↗
(data: unknown, fallback: string)

Source from the content-addressed store, hash-verified

105 * Extracts a human-readable error message from a Vanta API error body.
106 */
107export function extractVantaError(data: unknown, fallback: string): string {
108 if (!isRecordLike(data)) return fallback
109
110 if (isRecordLike(data.error)) {
111 const nested = getString(data.error.message) ?? getString(data.error.code)
112 if (nested) return nested
113 }
114
115 return (
116 getString(data.message) ??
117 getString(data.error_description) ??
118 getString(data.error) ??
119 fallback
120 )
121}
122
123export interface VantaTokenParams {
124 clientId: string

Callers 4

route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
exchangeVantaTokenFunction · 0.85

Calls 2

isRecordLikeFunction · 0.90
getStringFunction · 0.70

Tested by

no test coverage detected