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

Function isAbortError

common/src/util/error.ts:153–172  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

151 * - Native AbortError (thrown by fetch/AI SDK when AbortSignal is triggered)
152 */
153export function isAbortError(error: unknown): boolean {
154 if (!(error instanceof Error)) {
155 return false
156 }
157 // Check for our custom abort error message:
158 // - Exact match: 'Request aborted'
159 // - With reason: 'Request aborted: <reason>' (from AbortError class)
160 if (
161 error.message === ABORT_ERROR_MESSAGE ||
162 error.message.startsWith(`${ABORT_ERROR_MESSAGE}: `)
163 ) {
164 return true
165 }
166 // Check for native AbortError (DOMException or Error with name 'AbortError')
167 // This is thrown by fetch, AI SDK, and other web APIs when AbortSignal is triggered
168 if (error.name === 'AbortError') {
169 return true
170 }
171 return false
172}
173
174/**
175 * Unwrap a PromptResult, returning the value if successful or throwing if aborted.

Callers 10

loopAgentStepsFunction · 0.90
promptFlashWithFallbacksFunction · 0.90
requestRelevantFilesFunction · 0.90
outerCallerFunction · 0.90
callWithFallbackFunction · 0.90
outerOperationGoodFunction · 0.90
callWithFallbackOnErrorFunction · 0.90

Calls

no outgoing calls

Tested by 4

outerCallerFunction · 0.72
callWithFallbackFunction · 0.72
outerOperationGoodFunction · 0.72
callWithFallbackOnErrorFunction · 0.72