Allow custom unhandled error collector
|Reported by:||bersace||Owned by:|
I didn't found any proposition to allow custom handling of Unhandled error in Deferred, here is one.
Say you want a simple behaviour : stop the reactor if ever there is an unhandled error in a Deferred. Currently, there is no way for the code de provide a kind of global errback. I suggest to add an entry point to register such kind of errback.
I prototyped a solution by adding two functions : setErrorCollector and restoreErrorCollector. setErrorCollector takes as single parameter a callable called with DebugInfo object when it is garbage collected.
Attached is the prototype. Just run it to see it in action. It basically register a custom error collector, and triggers à unhandled error. The custom error collector just stop the reactor.
I agree that stopping the reactor is not that useful. But one can redirect the error to frontend, and other error handling.
Regards, Étienne BERSAC