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

Function extractErrorMessageWithId

apps/sim/tools/error-extractors.ts:268–286  ·  view source on GitHub ↗
(
  errorInfo: ErrorInfo | undefined,
  extractorId: string
)

Source from the content-addressed store, hash-verified

266const EXTRACTOR_MAP = new Map<string, ErrorExtractorConfig>(ERROR_EXTRACTORS.map((e) => [e.id, e]))
267
268export function extractErrorMessageWithId(
269 errorInfo: ErrorInfo | undefined,
270 extractorId: string
271): string {
272 const extractor = EXTRACTOR_MAP.get(extractorId)
273
274 if (!extractor) {
275 return `Request failed with status ${errorInfo?.status || 'unknown'}`
276 }
277
278 try {
279 const message = extractor.extract(errorInfo)
280 if (message?.trim()) {
281 return message
282 }
283 } catch (error) {}
284
285 return `Request failed with status ${errorInfo?.status || 'unknown'}`
286}
287
288export function extractErrorMessage(errorInfo?: ErrorInfo, extractorId?: string): string {
289 if (extractorId) {

Callers 1

extractErrorMessageFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected