export function isAbortError(error: unknown): boolean { if (error == null || typeof error !== 'object') { return false; } const err = error as { name?: string; code?: string | number }; if (err.name === 'AbortError' || err.name === 'CanceledError') { return true; } return err.code === 'ERR_CANCELED'; } /** Axios cancel token, CanceledError, AbortError, or ERR_CANCELED. */ export function isCanceledError(error: unknown): boolean { if (isAbortError(error)) { return true; } if (error == null || typeof error !== 'object') { return false; } /* eslint-disable @typescript-eslint/naming-convention -- axios Cancel token wire format */ const err = error as { __CANCEL__?: boolean }; return err.__CANCEL__ === true; /* eslint-enable @typescript-eslint/naming-convention */ }