isAbortError
isAbortError(
error):boolean
Defined in: core/errors.ts:37
Detects if an error is an abort/cancellation error from any provider.
Different providers throw different error types when a request is aborted:
- Standard:
AbortError(name) - from fetch/AbortController - Anthropic SDK:
APIConnectionAbortedError - OpenAI SDK:
APIUserAbortError - Generic: errors with “abort”, “cancelled”, or “canceled” in the message
Parameters
Section titled “Parameters”unknown
The error to check
Returns
Section titled “Returns”boolean
true if the error is an abort-related error, false otherwise
Example
Section titled “Example”import { isAbortError } from "@llmist/core/errors";
const controller = new AbortController();
try { for await (const chunk of client.stream({ signal: controller.signal, ... })) { // Process chunks... }} catch (error) { if (isAbortError(error)) { console.log("Request was cancelled - this is expected"); return; // Graceful exit } // Re-throw unexpected errors throw error;}