using throw from within then($onRejected) #479
-
I'm trying to handle errors with $reactBrowser->requestStreaming($method, $url, $headers, $body)->then(
function (ResponseInterface $response) {},
function (\Exception $reason) {
echo "DEAD !!!\n";
throw $reason; // <<< It's trapped somewhere
});
$loop->run(); I'm throwing the Is it a bug or is it by design ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @quazardous, this is not a bug and a known behavior, you can read more about it in reactphp/promise#87. You can try to handle the exception by using I hope this helps 👍 |
Beta Was this translation helpful? Give feedback.
Hey @quazardous, this is not a bug and a known behavior, you can read more about it in reactphp/promise#87. You can try to handle the exception by using
try
catch
, but we're aware that this is not the best behavior. As we speak we're in the middle of preparing a new major version (v3), where we also want to introduce better error and exception handling, @clue wrote about this in our wish list ticket here on GitHub : https://github.com/orgs/reactphp/discussions/472#discussioncomment-3880271I hope this helps 👍