From 35f6ee9c2d0ddcac1d46b6880d4b710dddd6368c Mon Sep 17 00:00:00 2001 From: ARYAN0-WORK Date: Sun, 24 May 2026 10:22:06 +0000 Subject: [PATCH] docs(5x): improving wording in error handling guide --- src/content/docs/en/5x/guide/error-handling.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/docs/en/5x/guide/error-handling.mdx b/src/content/docs/en/5x/guide/error-handling.mdx index e34218f841..367fcdf993 100644 --- a/src/content/docs/en/5x/guide/error-handling.mdx +++ b/src/content/docs/en/5x/guide/error-handling.mdx @@ -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. @@ -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 @@ -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) {