Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-04-02 04:46:17 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2019-04-04 13:51:03 +0300
commit3b044962c48fe313905877a96b5d0894a5404f6f (patch)
treef88086693fd685477a88b5cbc5c7442f25a49986 /lib/internal/stream_base_commons.js
parenta9bf6652b5353f2098d4c0cd0eb77d17e02e164d (diff)
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 <luigipinca@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'lib/internal/stream_base_commons.js')
-rw-r--r--lib/internal/stream_base_commons.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/stream_base_commons.js b/lib/internal/stream_base_commons.js
index 53ddc6336b7..0d9d449141e 100644
--- a/lib/internal/stream_base_commons.js
+++ b/lib/internal/stream_base_commons.js
@@ -214,7 +214,7 @@ function setStreamTimeout(msecs, callback) {
if (msecs === 0) {
if (callback !== undefined) {
if (typeof callback !== 'function')
- throw new ERR_INVALID_CALLBACK();
+ throw new ERR_INVALID_CALLBACK(callback);
this.removeListener('timeout', callback);
}
} else {
@@ -223,7 +223,7 @@ function setStreamTimeout(msecs, callback) {
if (callback !== undefined) {
if (typeof callback !== 'function')
- throw new ERR_INVALID_CALLBACK();
+ throw new ERR_INVALID_CALLBACK(callback);
this.once('timeout', callback);
}
}