Skip to content

Commit 256f069

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 256f069

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/patterns/error-handling.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ new Elysia()
308308
})
309309
```
310310

311+
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 and Headers](/tutorial/getting-started/status-and-headers) for more on using status codes.
312+
311313
<Playground
312314
:elysia="demo"
313315
/>

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 and Headers</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)