Skip to main content

Function: isAbortError()

isAbortError(error): boolean

Defined in: use-sequential-request.ts:25

Returns whether error is an abort error, such as the one a useSequentialRequest call rejects with when a newer call or an unmount cancels it, or the one fetch throws when its signal is aborted.

It checks the error's name, so it recognizes the standard DOMException as well as libraries that throw their own Error named "AbortError".

Parameters​

error​

unknown

The value caught from a rejected promise.

Returns​

boolean

true if error is an abort error.

Example​

try {
setResults(await search());
} catch (error) {
if (!isAbortError(error)) console.error("Search failed:", error);
}