Skip to content

Commit

Permalink
fix: don't enter error state when request is aborted (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-pledge-io authored May 21, 2024
1 parent 3e7f0b0 commit 1fbfdc5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,14 @@ export class UnleashClient extends TinyEmitter {
});
}
} catch (e) {
console.error('Unleash: unable to fetch feature toggles', e);
this.sdkState = 'error';
this.emit(EVENTS.ERROR, e);
if (!(e instanceof DOMException && e.name === 'AbortError')) {
console.error(
'Unleash: unable to fetch feature toggles',
e
);
this.sdkState = 'error';
this.emit(EVENTS.ERROR, e);
}
} finally {
this.abortController = null;
}
Expand Down

0 comments on commit 1fbfdc5

Please sign in to comment.