Skip to content

Commit 379e59e

Browse files
committed
Error early if callback argument to .query is not a function
closes mysqljs#1060
1 parent 29468b3 commit 379e59e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ you spot any mistakes.
77
## HEAD
88

99
* Delay implied connect until after `.query` argument validation
10+
* Error early if `callback` argument to `.query` is not a function #1060
1011
* Lazy-load modules from many entry point; reduced memory use
1112

1213
## v2.6.2 (2015-04-14)

lib/Connection.js

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Connection.createQuery = function createQuery(sql, values, callback) {
6767
options.values = undefined;
6868
}
6969

70+
if (cb === undefined && callback !== undefined) {
71+
throw new TypeError('argument callback must be a function when provided');
72+
}
73+
7074
return new Query(options, cb);
7175
};
7276

0 commit comments

Comments
 (0)