Skip to content

Commit

Permalink
Revert change to .finally()
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Jan 22, 2021
1 parent 8d295b9 commit 9deda89
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ export function cancelEsRequestOnAbort<T extends TransportRequestPromise<any>>(
promise.abort();
});

promise.finally(() => subscription.unsubscribe());
// using .catch() here means unsubscribe will be called
// after it has thrown an error, so we use .then(onSuccess, onFailure)
// syntax
promise.then(
() => subscription.unsubscribe(),
() => subscription.unsubscribe()
);

return promise;
}

0 comments on commit 9deda89

Please sign in to comment.