Skip to content

Commit

Permalink
fix(fetch): avoid throwing error on polyfilled envs
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv committed Jul 6, 2022
1 parent 5fa7d65 commit 5e4dad5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/requester-fetch/src/createFetchRequester.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { Request, Requester, Response as AlgoliaResponse } from '@algolia/requester-common';

function isAbortError(error: unknown): boolean {
return (
// browser fetch
(error instanceof DOMException && error.name === 'AbortError') ||
// node-fetch or undici
(error instanceof Error && error.name === 'AbortError')
);
return error instanceof Error && error.name === 'AbortError';
}

function getErrorMessage(error: unknown, abortContent: string): string {
Expand Down

0 comments on commit 5e4dad5

Please sign in to comment.