react-dom-stream
react-dom-stream copied to clipboard
problem: how to send 500 if a component throws an exception
I'm not sure I fully understand this yet, but if I do, then by the time react-dom-stream gets to a component that throws an error, a status code of 200 has already been written to the response header and it's impossible to send a 500 if an error occurs.
Is this an intractable problem? Maybe you know how other streaming servers deal with this, I don't.
Sounds like an HTTP trailer may be one option http://stackoverflow.com/questions/15305203/what-to-do-with-errors-when-streaming-the-body-of-an-http-request
http://engineering.pivotal.io/post/http-trailers/ I'll look into making a PR for this
As I know it at least doesn't work in Firefox.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer tells it's supported in all the major browsers.
@dmitry so I was confused by that article into thinking that X-Streaming-Error
was a sort of standard, but obviously it's not because I can't find it anywhere else on the web. Chrome certainly didn't show any error message when I sent it in a trailer. If only status code were a header, then it would be so easy...