Replies: 1 comment
-
Please try to use this app.get('/stream', (c) => {
return stream(
c,
async (stream) => {
// Write a process to be executed when aborted.
stream.onAbort(() => {
console.log('Aborted!')
})
// Write a Uint8Array.
await stream.write(
new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f])
)
// Pipe a readable stream.
await stream.pipe(anotherReadableStream)
},
(err, stream) => {
// return error page here
stream.writeln('An error occurred!')
console.error(err)
}
)
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm using
Hono
with Vercel AI SDK.It works perfectly using function(s) below when the stream is a success, but I'd like to handle errors.
If I'm able to
throw
(using eitheronError
callback orcatch()
), it does not escalate to the lastcatch()
andc.html(view())
does not display either.Do you know what I'm missing?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions