diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-02 03:46:17 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-04 12:51:03 +0200 |
commit | 3b044962c48fe313905877a96b5d0894a5404f6f (patch) | |
tree | f88086693fd685477a88b5cbc5c7442f25a49986 /test/parallel/test-process-next-tick.js | |
parent | a9bf6652b5353f2098d4c0cd0eb77d17e02e164d (diff) | |
download | android-node-v8-3b044962c48fe313905877a96b5d0894a5404f6f.tar.gz android-node-v8-3b044962c48fe313905877a96b5d0894a5404f6f.tar.bz2 android-node-v8-3b044962c48fe313905877a96b5d0894a5404f6f.zip |
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 'test/parallel/test-process-next-tick.js')
-rw-r--r-- | test/parallel/test-process-next-tick.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/parallel/test-process-next-tick.js b/test/parallel/test-process-next-tick.js index 59de0da42d..6641e17c24 100644 --- a/test/parallel/test-process-next-tick.js +++ b/test/parallel/test-process-next-tick.js @@ -21,6 +21,7 @@ 'use strict'; const common = require('../common'); +const { inspect } = require('util'); const N = 2; function cb() { @@ -38,10 +39,12 @@ process.on('exit', function() { }); [null, 1, 'test', {}, [], Infinity, true].forEach((i) => { - common.expectsError(() => process.nextTick(i), - { - code: 'ERR_INVALID_CALLBACK', - type: TypeError, - message: 'Callback must be a function' - }); + common.expectsError( + () => process.nextTick(i), + { + code: 'ERR_INVALID_CALLBACK', + type: TypeError, + message: `Callback must be a function. Received ${inspect(i)}` + } + ); }); |