GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http2: stream.respondWithFile, although capturing stream error when file not found, it also reflects error to req and res in compat layer · Issue #14963 · nodejs/node

http2: stream.respondWithFile, although capturing stream error when file not found, it also reflects error to req and res in compat layer #14963

New issue
Copy link
New issue
Copy link
Closed
Closed
http2: stream.respondWithFile, although capturing stream error when file not found, it also reflects error to req and res in compat layer#14963
Copy link
Labels
http2Issues and PRs related to the http2 subsystem.

Description

@akc42
akc42
opened on Aug 21, 2017
Issue body actions

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

  1. addaleax commented on Aug 21, 2017

    @addaleax
    addaleax
    on Aug 21, 2017
    Member
    More actions

    @nodejs/http2

  2. addaleax
    added
    http2Issues and PRs related to the http2 subsystem.
    on Aug 21, 2017
  3. jasnell commented on Aug 21, 2017

    @jasnell
    jasnell
    on Aug 21, 2017
    Member
    More actions

    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

  4. Trott
    added a commit that references this issue on Aug 25, 2017

    http2: refactor error handling

    4ca8ff2
  5. mcollina
    added 2 commits that reference this issue on Aug 27, 2017

    http2: refactor error handling

    054c9c6

    http2: respondWith* to the new error handling

    2857f15
  6. mcollina
    closed this as completedin 53c5bf5on Aug 27, 2017
  7. ghost added a commit that references this issue on Aug 30, 2017

    http2: refactor error handling

    cdc6217
  8. ghost added a commit that references this issue on Aug 30, 2017

    http2: refactor error handling

    03d1fc5
  9. ghost added a commit that references this issue on Aug 30, 2017

    http2: refactor error handling

    167382b
  10. ghost added a commit that references this issue on Aug 30, 2017

    http2: refactor error handling

    c2b861c
  11. MylesBorins
    added 2 commits that reference this issue on Sep 10, 2017

    http2: refactor error handling

    e1b267b

    http2: refactor error handling

    989dfaf
  12. sjarmak
    added a commit that references this issue on Jul 27, 2026

    http2: refactor error handling

    53c5bf5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues and PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.