Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

denilsonsa started this conversation in Content
Discussion options

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

You must be logged in to vote

Replies: 3 comments

Comment options

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.

You must be logged in to vote
0 replies
Comment options

Hi. Can i work on this issue?

You must be logged in to vote
0 replies
Comment options

Hi. Can i work on this issue?

Sure, please, go ahead!

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Converted from issue

This discussion was converted from issue #1069 on August 02, 2025 19:07.

AltStyle によって変換されたページ (->オリジナル) /