We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 59f9c28 commit bf258e8Copy full SHA for bf258e8
lib/client.js
@@ -167,6 +167,7 @@ Client.prototype.connect = function(callback) {
167
self.emit('error', error);
168
} else {
169
callback(error);
170
+ callback = null;
171
}
172
173
//need to sync after error during a prepared statement
@@ -180,6 +181,13 @@ Client.prototype.connect = function(callback) {
180
181
});
182
183
con.once('end', function() {
184
+ if ( callback ) {
185
+ // haven't received a connection message yet !
186
+ var err = new Error("Stream unexpectedly ended before getting ready for query execution");
187
+ callback(err);
188
189
+ return;
190
+ }
191
if(self.activeQuery) {
192
self.activeQuery.handleError(new Error('Stream unexpectedly ended during query execution'));
193
self.activeQuery = null;
0 commit comments