Skip to main content

Function: isAbortError()

function isAbortError(error: unknown): boolean;

Defined in: shared/utils/abortUtils.ts:612

Determines whether an unknown value represents an abort-style error.

Parametersโ€‹

errorโ€‹

unknown

Value to inspect.

Returnsโ€‹

boolean

true when the value represents an abort scenario; otherwise false.

Remarksโ€‹

The check covers native Error instances, DOM AbortError and TimeoutError exceptions, and message patterns commonly emitted by Fetch and other browser APIs.

Exampleโ€‹

import { logger } from "@app/services/logger";

try {
await fetch(url, { signal });
} catch (error) {
if (isAbortError(error)) {
logger.warn("Request was cancelled");
} else {
logger.error("Request failed", error);
}
}