MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / callWithFallback

Function callWithFallback

common/src/util/__tests__/error-abort.test.ts:424–440  ·  view source on GitHub ↗
(signal: { aborted: boolean })

Source from the content-addressed store, hash-verified

422 }
423
424 async function callWithFallback(signal: { aborted: boolean }): Promise<PromptResult<string>> {
425 try {
426 const result = await primaryProvider(signal)
427 // If aborted, don't try fallback
428 if (result.aborted) {
429 return result
430 }
431 return result
432 } catch (error) {
433 // Don't fall back on abort errors
434 if (isAbortError(error)) {
435 throw error
436 }
437 // Try fallback for other errors
438 return fallbackProvider(signal)
439 }
440 }
441
442 it('uses fallback on non-abort error', async () => {
443 const signal = { aborted: false }

Callers 1

Calls 3

isAbortErrorFunction · 0.90
primaryProviderFunction · 0.85
fallbackProviderFunction · 0.85

Tested by

no test coverage detected