Skip to content

Commit

Permalink
Re-throw abort errors (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
sslotsky authored Apr 9, 2020
1 parent 4db1dd8 commit d8ec880
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/v0/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export function createGateway({
try {
resp = await fetch(`${baseUrl()}${path}`, options);
} catch (e) {
if (e.name === 'AbortError') {
throw e;
}

if (canRetry) {
await wait(attempts ** 2 * 1000);
return post(path, body, attempts + 1, init);
Expand Down
4 changes: 4 additions & 0 deletions src/v0/graphqlFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ export function createGraphqlFetch({
options.body = JSON.stringify(args);
response = await fetch(endpoint(), options);
} catch (e) {
if (e.name === 'AbortError') {
throw e;
}

// Retry
if (canRetry) {
await wait(attempts ** 2 * 1000);
Expand Down

0 comments on commit d8ec880

Please sign in to comment.