diff --git a/docs/patterns/error-handling.md b/docs/patterns/error-handling.md index 7ad6e6a2..bbd052e0 100644 --- a/docs/patterns/error-handling.md +++ b/docs/patterns/error-handling.md @@ -21,6 +21,7 @@ import TutorialBadge from '../components/arona/badge.vue' import Card from '../components/nearl/card.vue' import Deck from '../components/nearl/card-deck.vue' import Playground from '../components/nearl/playground.vue' +import DocLink from '../components/xiao/doc-link/doc-link.vue' const demo = new Elysia() .onError(({ code }) => { @@ -308,6 +309,8 @@ new Elysia() }) ``` +Here we use `status(418)` which is the "I'm a teapot" status code. You can also use the string name directly: `status("I'm a teapot")`. See Status for more on using status codes. + diff --git a/docs/tutorial/getting-started/life-cycle/index.md b/docs/tutorial/getting-started/life-cycle/index.md index c11381dd..bb64cbbf 100644 --- a/docs/tutorial/getting-started/life-cycle/index.md +++ b/docs/tutorial/getting-started/life-cycle/index.md @@ -62,6 +62,8 @@ new Elysia() .get('/2', () => 'Hello Elysia!') ``` +Here we use `status(418)` which is the "I'm a teapot" status code. You can also use the string name directly: `status("I'm a teapot")`. See Status for more on using status codes. + When `beforeHandle` returns a value, it will skip the handler and return the value instead. This is useful for things like authentication, where you want to return a `401 Unauthorized` response if the user is not authenticated.