Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/content/docs/en/5x/guide/error-handling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ app.get('/', (req, res, next) => {
});
```

Since promises automatically catch both synchronous errors and rejected promises,
Since promises automatically handle both synchronous errors and rejected promises,
you can simply provide `next` as the final catch handler and Express will catch errors,
because the catch handler is given the error as the first argument.

Expand All @@ -132,7 +132,7 @@ app.get('/', [
]);
```

The above example has a couple of trivial statements from the `readFile`
The above example contains a couple of trivial statements following the `readFile`
call. If `readFile` causes an error, then it passes the error to Express, otherwise you
quickly return to the world of synchronous error handling in the next handler
in the chain. Then, the example above tries to process the data. If this fails, then the
Expand Down Expand Up @@ -258,7 +258,7 @@ function logErrors(err, req, res, next) {

Also in this example, `clientErrorHandler` is defined as follows; in this case, the error is explicitly passed along to the next one.

Notice that when _not_ calling "next" in an error-handling function, you are responsible for writing (and ending) the response. Otherwise, those requests will "hang" and will not be eligible for garbage collection.
Notice that when you do not call "next" in an error-handling function, you are responsible for writing (and ending) the response. Otherwise, those requests will "hang" and will not be eligible for garbage collection.

```js
function clientErrorHandler(err, req, res, next) {
Expand Down
Loading