Skip to content

Commit 9c2ba4b

Browse files
committed
Mark clients with closed connections as unusable consistently
1 parent 4c58e3f commit 9c2ba4b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ Client.prototype.connect = function (callback) {
208208
if (callback) {
209209
callback(error)
210210
} else {
211-
this.emit('error', error)
211+
connectedErrorHandler(error)
212212
}
213213
} else if (!this._connectionError) {
214-
this.emit('error', error)
214+
connectedErrorHandler(error)
215215
}
216216
}
217217
this.emit('end')

test/integration/connection-pool/error-tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ suite.test('connection-level errors cause queued queries to fail', (cb) => {
6060
}))
6161

6262
client.query('SELECT 1', assert.calls((err) => {
63-
assert.equal(err.code, 'EPIPE')
63+
assert.equal(err.message, 'Connection terminated unexpectedly')
6464

6565
done()
6666
pool.end()

0 commit comments

Comments
 (0)