From 68d6f6e0024a8041083221086912ca7f9a2c9c81 Mon Sep 17 00:00:00 2001 From: enisdenjo Date: Thu, 21 Oct 2021 11:24:03 +0200 Subject: [PATCH] refactor(client): reorder then and catch --- src/client.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index 1fb72092..25a6cfb6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -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