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

Function isRetryableFailure

apps/sim/tools/index.ts:1475–1487  ·  view source on GitHub ↗
(error: unknown, status?: number)

Source from the content-addressed store, hash-verified

1473}
1474
1475function isRetryableFailure(error: unknown, status?: number): boolean {
1476 if (status === 429 || (status && status >= 500 && status <= 599)) return true
1477 if (error instanceof Error) {
1478 const code = (error as NodeJS.ErrnoException).code
1479 if (code === 'ETIMEDOUT' || code === 'ECONNRESET' || code === 'ECONNABORTED') {
1480 return true
1481 }
1482 const msg = error.message.toLowerCase()
1483 if (isBodySizeLimitError(msg)) return false
1484 return msg.includes('timeout') || msg.includes('timed out')
1485 }
1486 return false
1487}
1488
1489function calculateBackoff(attempt: number, initialDelayMs: number, maxDelayMs: number): number {
1490 const base = Math.min(initialDelayMs * 2 ** attempt, maxDelayMs)

Callers 2

executeToolRequestFunction · 0.85

Calls 1

isBodySizeLimitErrorFunction · 0.85

Tested by

no test coverage detected