Skip to content

Commit a456cdf

Browse files
committed
refactor: move error listener registering
1 parent d537686 commit a456cdf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ function impl (req, resOrSocket, headOrNil, {
4545
onReq,
4646
onRes
4747
}, onProxyError) {
48-
// XXX http2.Http2ServerRequest doesn't forward stream errors.
49-
// (https://github.com/nodejs/node/issues/15359)
50-
(req.stream || req).on('error', onError)
51-
resOrSocket.on('error', onError)
52-
5348
function onError (err, statusCode = (err && err.statusCode) || 500) {
5449
if (resOrSocket.closed === true ||
5550
resOrSocket.headersSent !== false ||
@@ -68,6 +63,11 @@ function impl (req, resOrSocket, headOrNil, {
6863
}
6964
}
7065

66+
// XXX http2.Http2ServerRequest doesn't forward stream errors.
67+
// (https://github.com/nodejs/node/issues/15359)
68+
(req.stream || req).on('error', onError)
69+
resOrSocket.on('error', onError)
70+
7171
try {
7272
if (resOrSocket instanceof net.Socket) {
7373
if (req.method !== 'GET') {

0 commit comments

Comments
 (0)