MCPcopy Create free account
hub / github.com/TanStack/cli / getErrorCode

Function getErrorCode

packages/cli/src/telemetry.ts:130–166  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

128}
129
130function getErrorCode(error: unknown) {
131 if (!error || typeof error !== 'object') {
132 return 'unknown_error'
133 }
134
135 const message = String((<Record<string, unknown>>error).message || '').toLowerCase()
136
137 if (message.includes('cancel')) {
138 return 'cancelled'
139 }
140
141 if (message.includes('invalid')) {
142 return 'invalid_input'
143 }
144
145 if (message.includes('not found')) {
146 return 'not_found'
147 }
148
149 if (message.includes('timed out')) {
150 return 'timeout'
151 }
152
153 if (
154 message.includes('fetch') ||
155 message.includes('network') ||
156 message.includes('econn')
157 ) {
158 return 'network_error'
159 }
160
161 if (message.includes('permission') || message.includes('eacces')) {
162 return 'permission_error'
163 }
164
165 return 'unknown_error'
166}
167
168async function fetchTelemetryStatus() {
169 telemetryStatusPromise ??= getTelemetryStatus()

Callers 1

captureCommandFailedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected