We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 823b136 commit e20d5d4Copy full SHA for e20d5d4
test/response/stream.test.ts
@@ -71,11 +71,15 @@ describe('Stream', () => {
71
'event: message\ndata: "a"\n\nevent: error\ndata: "an error"\n\n'
72
)
73
})
74
-
+
75
it('handle errors before yield', async () => {
76
- const app = new Elysia().get('/', async function* () {
77
- throw new Error('an error')
78
- })
+ const app = new Elysia()
+ .onError(({ error }) => {
+ return new Response(error.message)
79
+ })
80
+ .get('/', async function* () {
81
+ throw new Error('an error')
82
83
84
const response = await app.handle(req('/')).then((x) => x.text())
85
0 commit comments