Skip to content

Log unhandled errors during perform #23

@radix

Description

@radix

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions