Dealing with errors in Response streams?
I've encountered problems whilst attempting to stream Responses, and discovered that if an error is thrown within the stream it just seems to be completely swallowed.
Here's a simple example:
Hit the server and the request fails, but no errors are logged.
Is there a preferred way to handle the errors in a stream?
Or this is a bug in Deno? IMHO it feels like one, I wouldn't expects errors to just silently vanish like this.
3 Replies
Ok, I think this is definitely a bug, a runtime should never silently discard an unhandled error.
It appears to have been reported before, so I've updated the ticket... https://github.com/denoland/deno/issues/19867
GitHub
Error in ReadableStream/TransformStream is swallowed in Deno.serve ...
The following Deno.serve code has a subtle error (toUppperCase -> toUpperCase). When running this code, there is nothing to implicate the failing TransformStream handler. Deno.serve((req) => ...
So, apart from the fact there may actually be a bug in Deno regarding the discarding of unhandled errors, is there a way to gracefully handle potential errors from streams in the web streams API?