mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
fix: only dispatch error events if we have a listener
This commit is contained in:
parent
acae15de53
commit
2f480217cb
6
index.js
6
index.js
@ -115,7 +115,11 @@ Cursor.prototype.handleError = function(msg) {
|
||||
for(var i = 0; i < this._queue.length; i++) {
|
||||
this._queue.pop()[1](msg)
|
||||
}
|
||||
this.emit('error', msg)
|
||||
|
||||
if (this.eventNames().indexOf('error') >= 0) {
|
||||
//only dispatch error events if we have a listener
|
||||
this.emit('error', msg)
|
||||
}
|
||||
//call sync to keep this connection from hanging
|
||||
this.connection.sync()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user