Skip to content
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

Log unhandled errors during perform #23

Open
radix opened this issue Dec 31, 2014 · 1 comment
Open

Log unhandled errors during perform #23

radix opened this issue Dec 31, 2014 · 1 comment

Comments

@radix
Copy link
Contributor

radix commented Dec 31, 2014

Unlike Deferreds, Effects can't have callbacks added to them after a result is available. This means that they have a handy property that once an effect has been performed, and it resulted in an error, we can know that that error won't be handled by any other code, and log it to stderr.

ideally the top-level of your program is:

from effect import perform
...
if __name__ == '__main__':
    perform(dispatcher, main())

in which case having a default logger seems like a pretty reasonable solution. But if you're using effect.twisted.perform, since it provides the result in a way other than callbacks to the effects (by returning it as a deferred), there is still a chance to add error-handling errbacks.

So how about this: effect.perform() could default to logging errors, since it's otherwise impossible for callers to report unhandled errors. effect.twisted.perform and effect.sync_perform should not have this behavior, and just have the same behavior they have now.

@tomprince
Copy link
Contributor

Note that effect.twisted.perform and effect.sync_perform never pass an effect that results in a error to perform (since they add error handlers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants