react-dom-stream icon indicating copy to clipboard operation
react-dom-stream copied to clipboard

problem: how to send 500 if a component throws an exception

Open jedwards1211 opened this issue 8 years ago • 4 comments

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.

jedwards1211 avatar Nov 01 '16 04:11 jedwards1211

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

jedwards1211 avatar Nov 01 '16 04:11 jedwards1211

http://engineering.pivotal.io/post/http-trailers/ I'll look into making a PR for this

jedwards1211 avatar Nov 01 '16 04:11 jedwards1211

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 avatar Nov 04 '16 10:11 dmitry

@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...

jedwards1211 avatar Nov 04 '16 15:11 jedwards1211