mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
http2: refer to stream errors by name
Display the constant name instead of a stream error code in the error message, because the numerical codes give absolutely no clue about what happened when an error is emitted. PR-URL: https://github.com/nodejs/node/pull/18966 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
1 parent
f2b9805f85
commit
7bc8eb8da7
19 files changed
+58
-43
No files matched your search
@@ -59,7 +59,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: `Stream closed with error code ${closeCode}`
|
||||
message: 'Stream closed with error code NGHTTP2_PROTOCOL_ERROR'
|
||||
}));
|
||||
|
||||
req.on('response', common.mustCall());
|
||||
|
||||
@@ -18,7 +18,8 @@ server.on('stream', (stream) => {
|
||||
// system specific timings.
|
||||
stream.on('error', (err) => {
|
||||
assert.strictEqual(err.code, 'ERR_HTTP2_STREAM_ERROR');
|
||||
assert.strictEqual(err.message, 'Stream closed with error code 2');
|
||||
assert.strictEqual(err.message,
|
||||
'Stream closed with error code NGHTTP2_INTERNAL_ERROR');
|
||||
});
|
||||
stream.respond();
|
||||
stream.end();
|
||||
|
||||
@@ -27,7 +27,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 1'
|
||||
message: 'Stream closed with error code NGHTTP2_PROTOCOL_ERROR'
|
||||
}));
|
||||
req.on('close', common.mustCall(() => countdown.dec()));
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 2'
|
||||
message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR'
|
||||
}));
|
||||
req.on('close', common.mustCall(() => countdown.dec()));
|
||||
|
||||
@@ -73,7 +73,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 2'
|
||||
message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR'
|
||||
}));
|
||||
req.on('close', common.mustCall(() => countdown.dec()));
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ function runTest(test) {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 2'
|
||||
message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR'
|
||||
}));
|
||||
|
||||
req.on('close', common.mustCall(() => {
|
||||
|
||||
@@ -50,7 +50,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 7'
|
||||
message: 'Stream closed with error code NGHTTP2_REFUSED_STREAM'
|
||||
}));
|
||||
}
|
||||
}));
|
||||
@@ -63,7 +63,7 @@ server.on('stream', (stream) => {
|
||||
stream.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 3'
|
||||
message: 'Stream closed with error code NGHTTP2_FLOW_CONTROL_ERROR'
|
||||
}));
|
||||
stream.on('close', common.mustCall(() => {
|
||||
server.close();
|
||||
|
||||
@@ -69,7 +69,7 @@ server.on('stream', (stream) => {
|
||||
stream.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 3'
|
||||
message: 'Stream closed with error code NGHTTP2_FLOW_CONTROL_ERROR'
|
||||
}));
|
||||
stream.on('close', common.mustCall(() => {
|
||||
server.close(common.mustCall());
|
||||
|
||||
@@ -41,7 +41,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 2'
|
||||
message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR'
|
||||
}));
|
||||
|
||||
req.on('response', common.mustCall());
|
||||
|
||||
@@ -58,7 +58,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 1'
|
||||
message: 'Stream closed with error code NGHTTP2_PROTOCOL_ERROR'
|
||||
}));
|
||||
}
|
||||
}));
|
||||
@@ -38,6 +38,6 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 7'
|
||||
message: 'Stream closed with error code NGHTTP2_REFUSED_STREAM'
|
||||
}));
|
||||
}));
|
||||
@@ -15,7 +15,7 @@ const {
|
||||
const errorCheck = common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: `Stream closed with error code ${NGHTTP2_INTERNAL_ERROR}`
|
||||
message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR'
|
||||
}, 2);
|
||||
|
||||
const server = http2.createServer();
|
||||
|
||||
@@ -80,7 +80,7 @@ function runTest(test) {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 2'
|
||||
message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR'
|
||||
}));
|
||||
|
||||
currentError = test;
|
||||
|
||||
@@ -88,7 +88,7 @@ function runTest(test) {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 2'
|
||||
message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR'
|
||||
}));
|
||||
|
||||
currentError = test;
|
||||
|
||||
@@ -20,7 +20,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 11'
|
||||
message: 'Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM'
|
||||
}));
|
||||
req.on('close', common.mustCall((code) => {
|
||||
assert.strictEqual(code, NGHTTP2_ENHANCE_YOUR_CALM);
|
||||
|
||||
@@ -23,7 +23,7 @@ server.listen(0, common.mustCall(() => {
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
type: Error,
|
||||
message: 'Stream closed with error code 11'
|
||||
message: 'Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM'
|
||||
}));
|
||||
req.on('close', common.mustCall((code) => {
|
||||
assert.strictEqual(code, NGHTTP2_ENHANCE_YOUR_CALM);
|
||||
|
||||
Reference in new issue
Block a user