Whatever was thrown or rejected with
true for an expected stop, false for a real failure
isExpectedAbort('user_aborted'); // true
isExpectedAbort('time_budget_exceeded'); // true
isExpectedAbort(new DOMException('x', 'AbortError')); // true
isExpectedAbort(new TypeError('bad response')); // false
export function isExpectedAbort(error: unknown): boolean {
if (isAbortError(error)) {
return true;
}
return typeof error === 'string' && Object.values<string>(SEARCH_ABORT_REASON).includes(error);
}
True when something stopped because the search was deliberately aborted: an
AbortError, or one of the bareSEARCH_ABORT_REASONstrings that a fetch rejects with whencontroller.abort(reason)is given a string. Use it to log such stops atdebug.