Skip to content

Commit 2196e4c

Browse files
juliuszaedevil
authored andcommitted
Fix "queryCallback is not a function"
1 parent 6ae44d5 commit 2196e4c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/client.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,15 @@ Client.prototype.query = function (config, values, callback) {
427427
var error = new Error('Query read timeout')
428428

429429
this.emit('error', error)
430-
queryCallback(error)
431430

432-
// we already returned an error,
433-
// just do nothing if query completes
434-
query.callback = () => {}
431+
if (typeof queryCallback === 'function') {
432+
queryCallback(error)
433+
434+
// we already returned an error,
435+
// just do nothing if query completes
436+
query.callback = () => {
437+
}
438+
}
435439

436440
// Remove from queue
437441
var index = this.queryQueue.indexOf(query)

0 commit comments

Comments
 (0)