summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-client-stream-destroy-before-connect.js
diff options
context:
space:
mode:
authorMatteo Collina <hello@matteocollina.com>2017-08-23 18:29:49 +0200
committerMatteo Collina <hello@matteocollina.com>2017-08-28 00:39:42 +0400
commit53c5bf546e8e52db5b11287ab3bf1375819b369b (patch)
treec09d44b9ddb9b13a49d6705f45ff9cd3bf110392 /test/parallel/test-http2-client-stream-destroy-before-connect.js
parent4d893e093a539518a201e4a4f40adc26b8bbf74e (diff)
downloadandroid-node-v8-53c5bf546e8e52db5b11287ab3bf1375819b369b.tar.gz
android-node-v8-53c5bf546e8e52db5b11287ab3bf1375819b369b.tar.bz2
android-node-v8-53c5bf546e8e52db5b11287ab3bf1375819b369b.zip
http2: refactor error handling
This changes the error handling model of ServerHttp2Stream, ServerHttp2Request and ServerHttp2Response. An 'error' emitted on ServerHttp2Stream will not go to 'uncaughtException' anymore, but to the server 'streamError'. On the stream 'error', ServerHttp2Request will emit 'abort', while ServerHttp2Response would do nothing. It also updates respondWith* to the new error handling. Fixes: https://github.com/nodejs/node/issues/14963 PR-URL: https://github.com/nodejs/node/pull/14991 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-client-stream-destroy-before-connect.js')
-rw-r--r--test/parallel/test-http2-client-stream-destroy-before-connect.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/test/parallel/test-http2-client-stream-destroy-before-connect.js b/test/parallel/test-http2-client-stream-destroy-before-connect.js
index d68e6b33ec..05ba63f0b5 100644
--- a/test/parallel/test-http2-client-stream-destroy-before-connect.js
+++ b/test/parallel/test-http2-client-stream-destroy-before-connect.js
@@ -36,18 +36,11 @@ server.on('listening', common.mustCall(() => {
req.destroy(err);
req.on('error', common.mustCall((err) => {
- const fn = err.code === 'ERR_HTTP2_STREAM_ERROR' ?
- common.expectsError({
- code: 'ERR_HTTP2_STREAM_ERROR',
- type: Error,
- message: 'Stream closed with error code 2'
- }) :
- common.expectsError({
- type: Error,
- message: 'test'
- });
- fn(err);
- }, 2));
+ common.expectsError({
+ type: Error,
+ message: 'test'
+ })(err);
+ }));
req.on('streamClosed', common.mustCall((code) => {
assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR);