From e04224a1e264295551b73e056db8fbd16bb8e8f2 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Wed, 21 Oct 2020 17:52:26 +0200 Subject: [PATCH] fix: catch error in upgrader close call --- src/upgrader.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/upgrader.js b/src/upgrader.js index d583a8b8..fd8fe119 100644 --- a/src/upgrader.js +++ b/src/upgrader.js @@ -271,10 +271,15 @@ class Upgrader { if (connection && args[1] === 'close' && args[2] && !_timeline.close) { // Wait for close to finish before notifying of the closure (async () => { - if (connection.stat.status === ConnectionStatus.OPEN) { - await connection.close() + try { + if (connection.stat.status === ConnectionStatus.OPEN) { + await connection.close() + } + } catch (err) { + log.error(err) + } finally { + this.onConnectionEnd(connection) } - this.onConnectionEnd(connection) })() }