Skip to content

Commit 5079c1e

Browse files
author
Victor Widell
committed
Added missing argument to handleError method call.
Before the change, it would crash with a very unhelpful error message: [project path]/node_modules/pg/lib/query.js:92 connection.sync(); ^ TypeError: Cannot call method 'sync' of undefined at Query.handleError ([project path]/node_modules/pg/lib/query.js:92:16) at Client.connect ([project path]/node_modules/pg/lib/client.js:178:24) at g (events.js:185:14) at EventEmitter.emit (events.js:85:17) at Socket.<anonymous> ([project path]/node_modules/pg/lib/connection.js:60:10) at Socket.EventEmitter.emit (events.js:85:17) at TCP.onread (net.js:424:51) After the change, it reports a much more helpful error running query [Error: Stream unexpectedly ended during query execution]
1 parent b12dd4c commit 5079c1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Client.prototype.connect = function(callback) {
175175
con.once('end', function() {
176176
if(self.activeQuery) {
177177
var disconnectError = new Error('Stream unexpectedly ended during query execution');
178-
self.activeQuery.handleError(disconnectError);
178+
self.activeQuery.handleError(disconnectError, con);
179179
self.activeQuery = null;
180180
}
181181
self.emit('end');

0 commit comments

Comments
 (0)