Skip to content

Commit

Permalink
Update q.js
Browse files Browse the repository at this point in the history
nfbind/denodeify: Throw error when wrapping an undefined function. Leads to clearer error message/stack (instead of throwing error when using the resulting promised wrapped function.
  • Loading branch information
DerekDomino committed Sep 30, 2015
1 parent 75058c0 commit 51d1dbd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions q.js
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,9 @@ Promise.prototype.nfcall = function (/*...args*/) {
*/
Q.nfbind =
Q.denodeify = function (callback /*...args*/) {
if (callback === undefined) {
throw new Error('Q Cannot wrap an undefined function');
}
var baseArgs = array_slice(arguments, 1);
return function () {
var nodeArgs = baseArgs.concat(array_slice(arguments));
Expand Down

0 comments on commit 51d1dbd

Please sign in to comment.