Skip to content

Commit

Permalink
refactor(client): reorder then and catch
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Oct 21, 2021
1 parent befb328 commit 68d6f6e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,15 +885,13 @@ export function createClient(options: ClientOptions): Client {
}
}
})()
.catch((err) => {
(errored = true), (done = true);
sink.error(err);
}) // rejects on close events and errors
.then(() => {
done = true;
// delivering either an error or a complete terminates the sequence
if (!errored) sink.complete();
}); // resolves on release or normal closure
}) // resolves on release or normal closure
.catch((err) => {
sink.error(err);
}); // rejects on close events and errors

return () => {
// dispose only of active subscriptions
Expand Down

0 comments on commit 68d6f6e

Please sign in to comment.