Skip to content

Documentation for middleware with 4 arguments should be linked from "writing middleware" #1069

Description

@denilsonsa

At http://expressjs.com/en/guide/writing-middleware.html, I see no mention of the error handling middleware, or even that 4-argument middleware exists. That page should have a mention (and a link to full documentation) just like how using middleware and app.use() already have.


Bonus feedback (that should probably be a separate issue anyway):

https://dev.to/nedsoft/central-error-handling-in-express-3aej - This third-party page notes that “The error-handling middleware must be the last among other middleware and routes for it to function correctly.”. If this note is so important, I think it should exist in the official documentation (or it should be more visible).


This was originally submitted as expressjs/express#4058

Activity

  1. wesleytodd commented on Oct 1, 2019

    @wesleytodd
    Member

    Hey @denilsonsa!

    That page should have a mention

    PRs are welcome! Here is that page's source: https://github.com/expressjs/expressjs.com/blob/gh-pages/en/guide/writing-middleware.md

    The error-handling middleware must be the last among other middleware and routes for it to function correctly.

    This is not correct. I don't have time to dig into the article you posted, but my original skim leaves me with questions. Error handling middleware can be in many places and work correctly. The part where they state that gives no context for why they think that, so I cannot even guess at what they mean.

  2. saurabhbazzad commented on Oct 5, 2019

    @saurabhbazzad

    Hi. Can i work on this issue?

  3. denilsonsa commented on Oct 13, 2019

    @denilsonsa
    Author

    Hi. Can i work on this issue?

    Sure, please, go ahead!

  4. locked and limited conversation to collaborators on Aug 2, 2025
  5. converted this issue into a discussion #2020 on Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions