You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
http2: stream.respondWithFile, although capturing stream error when file not found, it also reflects error to req and res in compat layer #14963
I'm using the http2.createSecureServer with a request handler which passes request (as req) and response (as res) streams to the handler.
I am using res.stream.respondWithFile()
I am trying to catch errors where the file is not found, so I listen for error event on the stream so my code is like below
res.stream.on('error', err => {
if (forwardError || !(err.code === 'ENOENT')) {
next(err);
} else {
//this was probably file not found, in which case we just go to next middleware function.
next();
}
});
res.stream.respondWithFile(
filename,
{ 'content-type': map[ext] || 'text/plain',
'cache-control': 'no-cache' },
{ statCheck });
Even though I am handling the stream error, I am getting the same error reflected again on both req and res variables.
This is fundamentally the following issue with a slight twist (listening to the stream error) nodejs/http2#168
which was raised before the code landed in node and is is still open
Activity
addaleax commentedon Aug 21, 2017
@nodejs/http2
jasnell commentedon Aug 21, 2017
Yep, the error handling on the compat api side has not yet been updated. I'm hoping to get to it this week if someone else doesn't beat me to it
http2: refactor error handling
http2: refactor error handling
http2: respondWith* to the new error handling
http2: refactor error handling
http2: refactor error handling
http2: refactor error handling
http2: refactor error handling
http2: refactor error handling
http2: refactor error handling
http2: refactor error handling