async def handle_message2(self, sender: str, data: AnyStr): logger.debug("Handling msg from %s", sender) data_logger.debug(data) done, pending = await asyncio.wait([self.manage(sender, data)]) t = list(done)[0] exc = t.exception() if exc: logger.error(log_exception(exc)) if self.supports_responses: return [ self.protocol.invalid_request_response(sender, data, exc) ] return t.result()
def log_exceptions(loop, context): logger.error(context['message']) logger.error(log_exception(context['exception'])) raise context['exception']
def log_task_exceptions(task): exc = task.exception() if exc: logger.error(log_exception(exc))
async def do_simple_actions(self, msg): for action in self.actions: try: await action.do_one(msg) except Exception as exc: logger.error(log_exception(exc))
def manage_error(exc): if exc: logger.error(log_exception(exc))