Skip to content

fix: delegate errors after headers are sent#379

Open
vibhor-aggr wants to merge 1 commit into
expressjs:masterfrom
vibhor-aggr:fix/delegate-sent-header-errors
Open

fix: delegate errors after headers are sent#379
vibhor-aggr wants to merge 1 commit into
expressjs:masterfrom
vibhor-aggr:fix/delegate-sent-header-errors

Conversation

@vibhor-aggr

Copy link
Copy Markdown

Adds the documented res.headersSent guard to the generated Express app error handler.

The generated template now delegates to the default Express error handler when headers were already sent, matching the guidance linked from #254. I also added a generated-output regression test so the default scaffold keeps this guard.

Refs #254.

Verification:

  • npm run lint
  • ./node_modules/.bin/mocha --reporter spec --check-leaks test/ --grep 'should create basic app$|should delegate errors after headers are sent'
  • git diff --check

Note: a full npm test run progressed through the new regression test and then failed in the existing --css sass installability case because generated apps depend on node-sass@4.14.1, whose node-gyp@3.8.0 build expects Python 2 and is incompatible with the local Node 24 toolchain. That failure is unrelated to this error-handler template change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant