fix: catch error in upgrader close call

This commit is contained in:
Jacob Heun
2020-10-21 17:52:26 +02:00
parent 4c6be91588
commit e04224a1e2

View File

@ -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)
})()
}