summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-server-settimeout-no-callback.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-04-02 03:46:17 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2019-04-04 12:51:03 +0200
commit3b044962c48fe313905877a96b5d0894a5404f6f (patch)
treef88086693fd685477a88b5cbc5c7442f25a49986 /test/parallel/test-http2-server-settimeout-no-callback.js
parenta9bf6652b5353f2098d4c0cd0eb77d17e02e164d (diff)
downloadandroid-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-http2-server-settimeout-no-callback.js')
-rw-r--r--test/parallel/test-http2-server-settimeout-no-callback.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/parallel/test-http2-server-settimeout-no-callback.js b/test/parallel/test-http2-server-settimeout-no-callback.js
index a43fbb2129..5dff0fa8e7 100644
--- a/test/parallel/test-http2-server-settimeout-no-callback.js
+++ b/test/parallel/test-http2-server-settimeout-no-callback.js
@@ -6,23 +6,23 @@ if (!common.hasCrypto)
const assert = require('assert');
const http2 = require('http2');
+const { inspect } = require('util');
// Verify that setTimeout callback verifications work correctly
const verifyCallbacks = (server) => {
const testTimeout = 10;
- const notFunctions = [true, 1, {}, [], null, 'test'];
- const invalidCallBackError = {
- type: TypeError,
- code: 'ERR_INVALID_CALLBACK',
- message: 'Callback must be a function'
- };
- notFunctions.forEach((notFunction) =>
+ [true, 1, {}, [], null, 'test'].forEach((notFunction) => {
common.expectsError(
() => server.setTimeout(testTimeout, notFunction),
- invalidCallBackError
- )
- );
+ {
+ type: TypeError,
+ code: 'ERR_INVALID_CALLBACK',
+ message: 'Callback must be a function. ' +
+ `Received ${inspect(notFunction)}`
+ }
+ );
+ });
// No callback
const returnedVal = server.setTimeout(testTimeout);