本文整理汇总了Python中tornado.concurrent.Future.exc_info方法的典型用法代码示例。如果您正苦于以下问题:Python Future.exc_info方法的具体用法?Python Future.exc_info怎么用?Python Future.exc_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.concurrent.Future
的用法示例。
在下文中一共展示了Future.exc_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listen_done
# 需要导入模块: from tornado.concurrent import Future [as 别名]
# 或者: from tornado.concurrent.Future import exc_info [as 别名]
def listen_done(f: Future):
logging.debug('[bot#%s] Terminated', kwargs['id'])
e = f.exception()
if e:
logging.debug('[bot#%s] Got exception: %s %s', kwargs['id'], format_exception(*f.exc_info()))
if isinstance(e, ApiError) and e.code == 401:
logging.warning('[bot#%d] Disabling due to connection error', kwargs['id'])
yield self.queue.send(QUEUE_BOTERATOR_BOT_REVOKE, dumps(dict(error=str(e), **kwargs)))
elif isinstance(e, ApiError) and e.code == 400 and 'chat not found' in e.description and \
str(kwargs['moderator_chat_id']) in e.request_body:
logging.warning('[bot#%d] Disabling due to unavailable moderator chat', kwargs['id'])
yield self.queue.send(QUEUE_BOTERATOR_BOT_REVOKE, dumps(dict(error=str(e), **kwargs)))
elif isinstance(e, ApiError) and e.code == 409 and 'webhook is active' in e.description:
logging.warning('[bot#%d] Disabling due to misconfigured webhook', kwargs['id'])
yield self.queue.send(QUEUE_BOTERATOR_BOT_REVOKE, dumps(dict(error=str(e), **kwargs)))
else:
IOLoop.current().add_timeout(timedelta(seconds=5), self._start_bot, **kwargs)
del self.slaves[kwargs['id']]