and app1 or app2 needs to answer with a 50x code this is the easiest way
to send immediately the response.
Did you have a different use in mind?
Or has someone a cleaner solution to handle cases like this?
cheers,
filippo
I agree that throwing a context tuple is probably a more elegant
solution than trying to deal with the 'err' element of the
ewgi_response tuple. This is another case where EWGI differs
significantly from WSGI. I believe that the Python WSGI spec included
the exc_info argument in the start_response callable because there was
a possibility that output had already been sent to the browser when
the failure happened. Because we have a more functional approach with
applications simply returning a ewgi_context tuple, that approach
doesn't make sense.
Shall we get rid of the 'err' element of the tuple and rely instead on
Mikael's suggestion for error handling?
While on the subject of error handling, the other case that we haven't
discussed is if a stream throws an error while being evaluated. Take
this trivial example:
Stream = fun() -> {<<"chunk">>, fun() -> throw({error, foo}) end} end.
Should we leave it up to the server implementation to handle this
correctly? I think that is probably the simplest solution.
Best,
Hunter
>
> Shall we get rid of the 'err' element of the tuple and rely instead on
> Mikael's suggestion for error handling?
Yes I think removing the error element shouldn't cause any trouble.
>
> While on the subject of error handling, the other case that we haven't
> discussed is if a stream throws an error while being evaluated. Take
> this trivial example:
>
> Stream = fun() -> {<<"chunk">>, fun() -> throw({error, foo}) end} end.
>
> Should we leave it up to the server implementation to handle this
> correctly? I think that is probably the simplest solution.
What is the correct way to handle an error during a chunked response?
We log the error, and send the last empty chunk?
best regards,
filippo