diff options
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/util.js b/lib/util.js index eabdf6c1df..2cf79bb5f0 100644 --- a/lib/util.js +++ b/lib/util.js @@ -323,7 +323,7 @@ Object.defineProperty(inspect, 'defaultOptions', { }, set(options) { if (options === null || typeof options !== 'object') { - throw new ERR_INVALID_ARG_TYPE('options', 'Object'); + throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); } return _extend(inspectDefaultOptions, options); } @@ -1024,13 +1024,14 @@ function log() { function inherits(ctor, superCtor) { if (ctor === undefined || ctor === null) - throw new ERR_INVALID_ARG_TYPE('ctor', 'Function'); + throw new ERR_INVALID_ARG_TYPE('ctor', 'Function', ctor); if (superCtor === undefined || superCtor === null) - throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function'); + throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor); if (superCtor.prototype === undefined) { - throw new ERR_INVALID_ARG_TYPE('superCtor.prototype', 'Function'); + throw new ERR_INVALID_ARG_TYPE('superCtor.prototype', + 'Function', superCtor.prototype); } ctor.super_ = superCtor; Object.setPrototypeOf(ctor.prototype, superCtor.prototype); @@ -1088,7 +1089,7 @@ function callbackifyOnRejected(reason, cb) { function callbackify(original) { if (typeof original !== 'function') { - throw new ERR_INVALID_ARG_TYPE('original', 'Function'); + throw new ERR_INVALID_ARG_TYPE('original', 'Function', original); } // We DO NOT return the promise as it gives the user a false sense that @@ -1097,7 +1098,7 @@ function callbackify(original) { function callbackified(...args) { const maybeCb = args.pop(); if (typeof maybeCb !== 'function') { - throw new ERR_INVALID_ARG_TYPE('last argument', 'Function'); + throw new ERR_INVALID_ARG_TYPE('last argument', 'Function', maybeCb); } const cb = (...args) => { Reflect.apply(maybeCb, this, args); }; // In true node style we process the callback on `nextTick` with all the |