Skip to content

Commit e04224a

Browse files
committed
fix: catch error in upgrader close call
1 parent 4c6be91 commit e04224a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/upgrader.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,15 @@ class Upgrader {
271271
if (connection && args[1] === 'close' && args[2] && !_timeline.close) {
272272
// Wait for close to finish before notifying of the closure
273273
(async () => {
274-
if (connection.stat.status === ConnectionStatus.OPEN) {
275-
await connection.close()
274+
try {
275+
if (connection.stat.status === ConnectionStatus.OPEN) {
276+
await connection.close()
277+
}
278+
} catch (err) {
279+
log.error(err)
280+
} finally {
281+
this.onConnectionEnd(connection)
276282
}
277-
this.onConnectionEnd(connection)
278283
})()
279284
}
280285

0 commit comments

Comments
 (0)