Skip to content

Commit

Permalink
fix; unhandled rejection using Query.then() (Fix #3543)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 7, 2015
1 parent 8cccafb commit 6ff39ef
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -2134,6 +2134,20 @@ Query.prototype.exec = function exec(op, callback) {
});
};

/**
* Executes the query returning a `Promise` which will be
* resolved with either the doc(s) or rejected with the error.
*
* @param {Function} [resolve]
* @param {Function} [reject]
* @return {Promise}
* @api public
*/

Query.prototype.then = function(resolve, reject) {
return this.exec().then(resolve, reject);
}

/**
* Finds the schema for `path`. This is different than
* calling `schema.path` as it also resolves paths with
Expand Down

0 comments on commit 6ff39ef

Please sign in to comment.