Skip to content

Commit 404cf92

Browse files
committed
Fix "queryCallback is not a function"
1 parent dc12e9a commit 404cf92

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
@@ -380,11 +380,15 @@ Client.prototype.query = function (config, values, callback) {
380380
var error = new Error('Query read timeout')
381381

382382
this.emit('error', error)
383-
queryCallback(error)
384383

385-
// we already returned an error,
386-
// just do nothing if query completes
387-
query.callback = () => {}
384+
if (typeof queryCallback === 'function') {
385+
queryCallback(error)
386+
387+
// we already returned an error,
388+
// just do nothing if query completes
389+
query.callback = () => {
390+
}
391+
}
388392

389393
// Remove from queue
390394
var index = this.queryQueue.indexOf(query)

0 commit comments

Comments
 (0)