Skip to content

Commit 39e1a5a

Browse files
authored
fixed multiple grammatical errors in docs. (#1497)
* fixed grammatical errors in faq docs * fixed grammatical and style issues in error handling docs * fixed grammatical issues in guide * fixed grammatical error in error handling docs * Updated middleware to use plural form to be middleware instead of middlewares
1 parent 68d97d6 commit 39e1a5a

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

docs/error-handling.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Try-Catch
44

5-
Using async functions means that you can try-catch `next`.
5+
Using async functions mean that you can try-catch `next`.
66
This example adds a `.status` to all errors:
77

88
```js
@@ -18,9 +18,9 @@
1818

1919
### Default Error Handler
2020

21-
The default error handler is essentially a try-catch at
21+
The default error handler is essentially a `try-catch` at
2222
the very beginning of the middleware chain. To use a
23-
different error handler, simply put another try-catch at
23+
different error handler, simply put another `try-catch` at
2424
the beginning of the middleware chain, and handle the error
2525
there. However, the default error handler is good enough for
2626
most use cases. It will use a status code of `err.status`,
@@ -29,7 +29,7 @@
2929
error code will be used (e.g. for the code 500 the message
3030
"Internal Server Error" will be used). All headers will be
3131
cleared from the request, but any headers in `err.headers`
32-
will then be set. You can use a try-catch, as specified
32+
will then be set. You can use a `try-catch`, as specified
3333
above, to add a header to this list.
3434

3535
Here is an example of creating your own error handler:
@@ -52,7 +52,7 @@ app.use(async (ctx, next) => {
5252

5353
Error event listeners can be specified with `app.on('error')`.
5454
If no error listener is specified, a default error listener
55-
is used. Error listener receive all errors that make their
55+
is used. Error listeners receive all errors that make their
5656
way back through the middleware chain, if an error is caught
5757
and not thrown again, it will not be passed to the error
5858
listener. If no error event listener is specified, then

docs/guide.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55

66
## Table of Contents
77

8-
- [Writing Middleware](#writing-middleware)
9-
- [Middleware Best Practices](#middleware-best-practices)
10-
- [Middleware options](#middleware-options)
11-
- [Named middleware](#named-middleware)
12-
- [Combining multiple middleware with koa-compose](#combining-multiple-middleware-with-koa-compose)
13-
- [Response Middleware](#response-middleware)
14-
- [Async operations](#async-operations)
15-
- [Debugging Koa](#debugging-koa)
8+
- [Guide](#guide)
9+
- [Table of Contents](#table-of-contents)
10+
- [Writing Middleware](#writing-middleware)
11+
- [Middleware Best Practices](#middleware-best-practices)
12+
- [Middleware options](#middleware-options)
13+
- [Named middleware](#named-middleware)
14+
- [Combining multiple middleware with koa-compose](#combining-multiple-middleware-with-koa-compose)
15+
- [Response Middleware](#response-middleware)
16+
- [Async operations](#async-operations)
17+
- [Debugging Koa](#debugging-koa)
1618

1719
## Writing Middleware
1820

@@ -59,7 +61,7 @@ app.use(responseTime);
5961

6062
### Middleware options
6163

62-
When creating public middleware it's useful to conform to the convention of
64+
When creating a public middleware, it's useful to conform to the convention of
6365
wrapping the middleware in a function that accepts options, allowing users to
6466
extend functionality. Even if your middleware accepts _no_ options, this is still
6567
a good idea to keep things uniform.

0 commit comments

Comments
 (0)