errors: add more information in case of invalid callbacks · nodejs/node@3b04496 (original) (raw)
`@@ -1058,7 +1058,7 @@ class Http2Session extends EventEmitter {
`
1058
1058
`throw new ERR_HTTP2_PING_LENGTH();
`
1059
1059
`}
`
1060
1060
`if (typeof callback !== 'function')
`
1061
``
`-
throw new ERR_INVALID_CALLBACK();
`
``
1061
`+
throw new ERR_INVALID_CALLBACK(callback);
`
1062
1062
``
1063
1063
`const cb = pingCallback(callback);
`
1064
1064
`if (this.connecting || this.closed) {
`
`@@ -1148,7 +1148,7 @@ class Http2Session extends EventEmitter {
`
1148
1148
`validateSettings(settings);
`
1149
1149
``
1150
1150
`if (callback && typeof callback !== 'function')
`
1151
``
`-
throw new ERR_INVALID_CALLBACK();
`
``
1151
`+
throw new ERR_INVALID_CALLBACK(callback);
`
1152
1152
`` debug(Http2Session ${sessionName(this[kType])}: sending settings
);
``
1153
1153
``
1154
1154
`this[kState].pendingAck++;
`
`@@ -1900,7 +1900,7 @@ class Http2Stream extends Duplex {
`
1900
1900
`if (code < 0 || code > kMaxInt)
`
1901
1901
`` throw new ERR_OUT_OF_RANGE('code', >= 0 && <= ${kMaxInt}
, code);
``
1902
1902
`if (callback !== undefined && typeof callback !== 'function')
`
1903
``
`-
throw new ERR_INVALID_CALLBACK();
`
``
1903
`+
throw new ERR_INVALID_CALLBACK(callback);
`
1904
1904
``
1905
1905
`if (this.closed)
`
1906
1906
`return;
`
`@@ -2256,7 +2256,7 @@ class ServerHttp2Stream extends Http2Stream {
`
2256
2256
`}
`
2257
2257
``
2258
2258
`if (typeof callback !== 'function')
`
2259
``
`-
throw new ERR_INVALID_CALLBACK();
`
``
2259
`+
throw new ERR_INVALID_CALLBACK(callback);
`
2260
2260
``
2261
2261
`assertIsObject(options, 'options');
`
2262
2262
`options = { ...options };
`
`@@ -2690,7 +2690,7 @@ class Http2SecureServer extends TLSServer {
`
2690
2690
`this.timeout = msecs;
`
2691
2691
`if (callback !== undefined) {
`
2692
2692
`if (typeof callback !== 'function')
`
2693
``
`-
throw new ERR_INVALID_CALLBACK();
`
``
2693
`+
throw new ERR_INVALID_CALLBACK(callback);
`
2694
2694
`this.on('timeout', callback);
`
2695
2695
`}
`
2696
2696
`return this;
`
`@@ -2711,7 +2711,7 @@ class Http2Server extends NETServer {
`
2711
2711
`this.timeout = msecs;
`
2712
2712
`if (callback !== undefined) {
`
2713
2713
`if (typeof callback !== 'function')
`
2714
``
`-
throw new ERR_INVALID_CALLBACK();
`
``
2714
`+
throw new ERR_INVALID_CALLBACK(callback);
`
2715
2715
`this.on('timeout', callback);
`
2716
2716
`}
`
2717
2717
`return this;
`