Skip to content

Commit

Permalink
Closes #3381
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Nov 29, 2016
1 parent b617d63 commit 386bb94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const Auth = require('./auth');
const Compression = require('./compression');
const Cors = require('./cors');
const Ext = require('./ext');
const Promises = require('./promises');
const Route = require('./route');


Expand Down Expand Up @@ -281,7 +280,7 @@ internals.Connection.prototype._dispatch = function (options) {
internals.Connection.prototype.inject = function (options, callback) {

if (!callback) {
return Promises.wrap(this, this.inject, [options]);
return new Promise((resolve, reject) => this.inject(options, (res) => resolve(res)));
}

let settings = options;
Expand Down
6 changes: 3 additions & 3 deletions lib/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ exports.wrap = function (bind, method, args) {

return new Promise((resolve, reject) => {

const callback = (result) => {
const callback = (err, result) => {

if (result instanceof Error) {
return reject(result);
if (err) {
return reject(err);
}

return resolve(result);
Expand Down

0 comments on commit 386bb94

Please sign in to comment.