File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,11 @@ const demo = new Elysia()
2828 })
2929 .get (' /throw' , ({ status }) => {
3030 // This will be caught by onError
31- throw status (418 ) // or status("I'm a teapot")
31+ throw status (418 )
3232 })
3333 .get (' /return' , ({ status }) => {
3434 // This will NOT be caught by onError
35- return status (418 ) // or status("I'm a teapot")
35+ return status (418 )
3636 })
3737</script >
3838
Original file line number Diff line number Diff line change @@ -19,22 +19,22 @@ import { Elysia } from 'elysia'
1919import Playground from ' ./components/nearl/playground.vue'
2020
2121const profile1 = new Elysia ()
22- .onBeforeHandle (({ status }) => status (401 ))
23- .get (' /profile' , ({ status }) => status (401 ))
22+ .onBeforeHandle (({ status }) => status (" Unauthorized " ))
23+ .get (' /profile' , ({ status }) => status (" Unauthorized " ))
2424
2525const demo1 = new Elysia ()
2626 .use (profile1)
2727 // This will NOT have sign in check
2828 .patch (' /rename' , () => ' Updated!' )
2929
3030const profile2 = new Elysia ()
31- .onBeforeHandle ({ as: ' global' }, ({ status }) => status (401 ))
32- .get (' /profile' , ({ status }) => status (401 ))
31+ .onBeforeHandle ({ as: ' global' }, ({ status }) => status (" Unauthorized " ))
32+ .get (' /profile' , ({ status }) => status (" Unauthorized " ))
3333
3434const demo2 = new Elysia ()
3535 .use (profile2)
3636 // This will NOT have sign in check
37- .patch (' /rename' , ({ status }) => status (401 ))
37+ .patch (' /rename' , ({ status }) => status (" Unauthorized " ))
3838</script >
3939
4040# Key Concept <Badge type =" danger " text =" MUST READ " />
Original file line number Diff line number Diff line change @@ -28,11 +28,11 @@ const demo = new Elysia()
2828 })
2929 .get (' /throw' , ({ error }) => {
3030 // This will be caught by onError
31- throw error (418 ) // or error("I'm a teapot")
31+ throw error (418 )
3232 })
3333 .get (' /return' , ({ status }) => {
3434 // This will NOT be caught by onError
35- return status (418 ) // or status("I'm a teapot")
35+ return status (418 )
3636 })
3737
3838const demo2 = new Elysia ()
@@ -300,11 +300,11 @@ new Elysia()
300300 })
301301 .get (' /throw' , ({ status }) => {
302302 // This will be caught by onError
303- throw status (418 ) // or status("I'm a teapot")
303+ throw status (418 )
304304 })
305305 .get (' /return' , ({ status }) => {
306306 // This will NOT be caught by onError
307- return status (418 ) // or status("I'm a teapot")
307+ return status (418 )
308308 })
309309```
310310
You can’t perform that action at this time.
0 commit comments