Description
Sadly, Twisted's Failure is not a third-party module, or I'd have used it from the beginning.
There is the effect.twisted.exc_info_to_failure utility function, which helps marginally for Twisted users, but it's still not great. And for anyone else, exc_info tuples are downright unwieldy -- you have to import the traceback
module and apply the tuple to traceback.print_exception
-- so it can't simply be added as a callback, without a lambda wrapping it like lambda exc_info: traceback.print_exception(*exc_info)
.
And that's just to print it -- if you want to log it with the stdlib logging
module, you have to ... actually, I don't even know how you pass a traceback to the logging
module, after briefly looking at its documentation. So, clearly, this is a user experience that could be vastly improved.
I don't know what the solution is. Maybe Failure could be factored out to its own third-party library, but that will probably be a lot of work. Whatever it is, I want errors from Effects to be trivial to print, log, and handle as structured data.