Uh oh!
There was an error while loading. Please reload this page.
Avoid hidding exceptions thrown in HttpClient\Request error handlers - #31
Conversation
clue
commented
Jun 7, 2015
Thanks for spotting! These could certainly introduce some subtle and hard to trace issues. Afaict you're trying to throw an Can you provide a simple gist that exhibits this? |
arnaud-lb
commented
Jun 8, 2015
Hi @clue,
I guess the request/response shouldn't be considered to be in a consistent state after that :) But at least, the exception should be allowed to unwind and eventually trigger a visible error if not caught by user code.
I'm guilty, I didn't planned for that when I wrote reactphp/http-client :)
Sure ! Here it is: https://gist.github.com/arnaud-lb/71cf44ab2564b810b463 As you can see, I'm not throwing an exception myself. (And at first, one wouldn't think that the exception is thrown in the error event handler; but it is.) However, I'm expecting to at least see exceptions that are thrown. The problem disappears after merging both reactphp/dns#26 and #31. Thanks! |
WyriHaximus
commented
Jun 23, 2015
Going to review and test this tonight and get back to it here, thanks for spotting 👍 |
WyriHaximus
commented
Jun 23, 2015
LGTM 👍 , @clue do you want to check, merge and tag reactphp/dns#26 first before signing this one off or should I go ahead and merge and tag this one first? |
clue
commented
Sep 7, 2015
Thanks for the background @arnaud-lb! LGTM 👍 @WyriHaximus both PRs LGTM, so feel free to review the other one and push either one forward 👍 |
clue
commented
Sep 23, 2015
Ping @arnaud-lb, can you update this to require Otherwise LGTM 👍 |
jsor
commented
Sep 24, 2015
LGTM 👍 |
Required promise ~2.2
Avoid hidding exceptions thrown in HttpClient\Request error handlers
then()catches exceptions, which is not desirable when its result is not returned.The following code throws an exception in the 'error' event handler. However, the exception is caught because the event is fired in a
then()callback.This PR fixes this by changing a
thento adone.Actual use case: