On 2/6/2014, 5:06 PM, Victor Stinner wrote:
Hi,

2014-02-06 17:53 GMT+01:00 Yury Selivanov <yselivanov...@gmail.com>:
I'm proposing a strawman design for having a user definable event loop
handler for unhandled exceptions.
With my short experience of asyncio, I can say that it's a pain to
reconnect an "unhandled exception" to the future and the original
source code.

   - "loop.set_exception_handler(callback)"
     Sets 'callback' as a new unhandled error handler for the event loop
     'loop'. The signature of callback should be '(loop, exception, context)'
... so it would be nice to give something to retrieve the source of
the exception. The minimum would be the future, task, or handle
object. The new parameter may be None if it doesn't apply.
I feel your pain ;)

However, I'm not sure how passing the future/handle to the
handler may help.  You have the name of the failed callback
in the traceback of the exception.  And, in many places all
you have is just the failed callback function, and no
related future or task.

Maybe you can show some real examples? (and implementation
suggestions)

Yury

Reply via email to