
Lesson 04 · 10 min
Error handling
One error handler for the whole app and no stack traces leaking out.
Express treats middleware with four arguments (err, req, res, next) as an error handler. It goes last. Any next(err) or error thrown in sync code lands there. In Express 4 you have to pass errors from async functions to next yourself.
Sign in to continue
The rest of this lesson opens after sign up
The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.