FIX: Refused connections are now handled gracefully

This commit is contained in:
Thomas P 2019-10-12 00:34:27 +02:00
parent d702c455bd
commit eda98986f2
No known key found for this signature in database
GPG Key ID: 722E1405F9F15F5E
1 changed files with 2 additions and 0 deletions

View File

@ -1013,6 +1013,8 @@ Client.prototype.connect = function connect () {
// Communicate the last-encountered error
if (err instanceof ConnectionError) {
self.emit('connectTimeout', err)
} else if (err.code === 'ECONNREFUSED') {
self.emit('connectRefused', err)
} else {
self.emit('error', err)
}