From 3b044962c48fe313905877a96b5d0894a5404f6f Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 2 Apr 2019 03:46:17 +0200 Subject: errors: add more information in case of invalid callbacks This adds the actual callback that is passed through to the error message in case an ERR_INVALID_CALLBACK error is thrown. PR-URL: https://github.com/nodejs/node/pull/27048 Reviewed-By: Luigi Pinca Reviewed-By: Yongsheng Zhang --- lib/dns.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/dns.js') diff --git a/lib/dns.js b/lib/dns.js index 3d057d6b50..f9c724e7b6 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -98,7 +98,7 @@ function lookup(hostname, options, callback) { callback = options; family = 0; } else if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(); + throw new ERR_INVALID_CALLBACK(callback); } else if (options !== null && typeof options === 'object') { hints = options.hints >>> 0; family = options.family >>> 0; @@ -174,7 +174,7 @@ function lookupService(hostname, port, callback) { throw new ERR_SOCKET_BAD_PORT(port); if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(); + throw new ERR_INVALID_CALLBACK(callback); port = +port; @@ -213,7 +213,7 @@ function resolver(bindingName) { validateString(name, 'name'); if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(); + throw new ERR_INVALID_CALLBACK(callback); } const req = new QueryReqWrap(); -- cgit v1.2.3