errorhandler icon indicating copy to clipboard operation
errorhandler copied to clipboard

Environment check in README documentation is out of date / not working?

Open andykorth opened this issue 1 year ago • 0 comments

Description

The README documentation for errorhandler (under "Simple example") suggests registering the errorhandler like this:

  // only use in development
  app.use(errorhandler())
}

However, when I launch my express.js app with npm run dev it does not actually execute that line. Other places I look suggest checking your dev environment like this: if ( app.get('env') === 'development' ) { ...

This does work for me. Which is correct? Are there more addendums to the examples than I realize?

I'm using [email protected].

The documentation in the README is also mirrored to https://expressjs.com/en/resources/middleware/errorhandler.html

Expectations

README documentation should work, as-is.

andykorth avatar Oct 18 '24 18:10 andykorth