-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call of done() is absent #339
Comments
Can you be more specific in what error is being ignored and/or provide a small gist to reproduce this? |
If we add |
I'm not sure I follow what problem we're discussing here, my take away is... well, if we break the code, then it's broken. Right now, I'm still not seeing anything that is broken. If you can provide a test case and/or gist to reproduce a problem, then I'm happy to look into this and help working out a solution. I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can reopen this 👍 On top of this, we're working on logging unhandled promise rejections as part of the promise library via reactphp/promise#87 in the future. Once this is in upstream, any unhandled promise rejection should at least log a warning without any changes downstream in this component. |
When we open this page, we will got 504 error and there is no any error in any log.
|
@RedKlaus Thanks for providing a short gist to reproduce this. In fact, you're not the first to run into this known limitation (e.g. clue/reactphp-redis#74) which is why we've started working on this a while ago. As a quick solution, throwing from any event handler is not allowed, so you can simply change your code to manually wrap this in a try-catch block and handle it accordingly for your use case. After all, what is supposed to happen with this exception in the first place? As a longer-term solution, this will be addressed upstream via reactphp/promise#87 and will likely report some form of warning in the future. If you feel there's a better way to handle this, make sure to let us know and I'm happy to look into this 👍 |
The simplest way is call |
This is a "golden rule" and I think it is a good one. |
Yes in most cases this is true, but in this specific case we're handling the error in the final then. What I usually do, and also suggest @RedKlaus looks into, is logging the error in the on error handler like this: $server->on('error', CallableThrowableLogger::create($logger));
^ That will push the error onto a logger and you can ship it off where you like it like loggly or your STDOUT for local logging |
Thank you for your advice, but I don't trust your code anymore) I no need to see errors thrown by me. I need to see errors, that occure by unknown reasons. Because shit happens with all kind of programmers) |
@WyriHaximus,
Exception will be silenced. But if you replace
Exception will be shown, golden rule is followed and no additional calls for every response is need. |
Thank you for those examples, it gave me the click the problem I needed. We could simply fix that in this package using the following code: \React\Promise\resolve()->then(function () {
throw new Exception('some error');
})->then(null, function (Exception $e) {
var_dump($e);
}); The thing is we still support |
@WyriHaximus thanks. Now I understand why not to |
@WyriHaximus, ok) I take my words back. I'm sorry. |
Good day.
Here in
\React\Http\StreamingServer::handleRequest
(StreamingServer.php:274) call ofdone()
is absent. This may lead to ignoring the error.The text was updated successfully, but these errors were encountered: