Skip to content

Commit e602561

Browse files
committed
docs: add contextual notes about string status names
Add educational paragraphs explaining that status(418) can also be written as status("I'm a teapot") using Elysia's string status name feature. These notes appear where 418 status codes are used in examples, helping readers discover this feature in context.
1 parent 5e5da8b commit e602561

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/patterns/error-handling.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import TutorialBadge from '../components/arona/badge.vue'
2121
import Card from '../components/nearl/card.vue'
2222
import Deck from '../components/nearl/card-deck.vue'
2323
import Playground from '../components/nearl/playground.vue'
24+
import DocLink from '../components/xiao/doc-link/doc-link.vue'
2425

2526
const demo = new Elysia()
2627
.onError(({ code }) => {
@@ -308,6 +309,8 @@ new Elysia()
308309
})
309310
```
310311

312+
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 <DocLink href="/tutorial/getting-started/status-and-headers#status">Status</DocLink> for more on using status codes.
313+
311314
<Playground
312315
:elysia="demo"
313316
/>

docs/tutorial/getting-started/life-cycle/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ new Elysia()
6262
.get('/2', () => 'Hello Elysia!')
6363
```
6464

65+
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 <DocLink href="/tutorial/getting-started/status-and-headers#status">Status</DocLink> for more on using status codes.
66+
6567
When `beforeHandle` returns a value, it will skip the handler and return the value instead.
6668

6769
This is useful for things like authentication, where you want to return a `401 Unauthorized` response if the user is not authenticated.

0 commit comments

Comments
 (0)