Fix logging of functools.partial() callbacks

This commit is contained in:
Lonami Exo 2018-07-21 17:52:42 +02:00
parent 3d7bff64c2
commit 46b2d910d7

View File

@ -283,16 +283,15 @@ class UpdateMethods(UserMethods):
try: try:
await callback(event) await callback(event)
except events.StopPropagation: except events.StopPropagation:
name = getattr(callback, '__name__', repr(callback))
__log__.debug( __log__.debug(
"Event handler '{}' stopped chain of " 'Event handler "%s" stopped chain of propagation '
"propagation for event {}." 'for event %s.', name, type(event).__name__
.format(callback.__name__,
type(event).__name__)
) )
break break
except Exception: except Exception:
__log__.exception('Unhandled exception on {}' name = getattr(callback, '__name__', repr(callback))
.format(callback.__name__)) __log__.exception('Unhandled exception on %s', name)
async def _handle_auto_reconnect(self): async def _handle_auto_reconnect(self):
# Upon reconnection, we want to send getState # Upon reconnection, we want to send getState