Skip to content

Commit 386bb94

Browse files
committed
Closes hapijs#3381
1 parent b617d63 commit 386bb94

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/connection.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const Auth = require('./auth');
1616
const Compression = require('./compression');
1717
const Cors = require('./cors');
1818
const Ext = require('./ext');
19-
const Promises = require('./promises');
2019
const Route = require('./route');
2120

2221

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

283282
if (!callback) {
284-
return Promises.wrap(this, this.inject, [options]);
283+
return new Promise((resolve, reject) => this.inject(options, (res) => resolve(res)));
285284
}
286285

287286
let settings = options;

lib/promises.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ exports.wrap = function (bind, method, args) {
1212

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

15-
const callback = (result) => {
15+
const callback = (err, result) => {
1616

17-
if (result instanceof Error) {
18-
return reject(result);
17+
if (err) {
18+
return reject(err);
1919
}
2020

2121
return resolve(result);

0 commit comments

Comments
 (0)