本文整理汇总了Python中common.utils.Basic.exception_is_a方法的典型用法代码示例。如果您正苦于以下问题:Python Basic.exception_is_a方法的具体用法?Python Basic.exception_is_a怎么用?Python Basic.exception_is_a使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.utils.Basic
的用法示例。
在下文中一共展示了Basic.exception_is_a方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _port_test_failure
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import exception_is_a [as 别名]
def _port_test_failure(reason):
# is this one of the errors that corresponds to unreachability?
if Basic.exception_is_a(reason, [CannotListenError, TimeoutError]):
return False
# otherwise, we do not know the state of reachability (None signals that)
# and log the error if necessary
unexpectedException = not Basic.exception_is_a(reason, [ConnectError])
if unexpectedException:
log_ex(reason, "Unexpected failure while testing port")
return None
示例2: error
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import exception_is_a [as 别名]
def error(failure):
if not self.is_done():
if Basic.exception_is_a(failure, [TorCtl.TorCtlClosed, TorCtl.ErrorReply]):
log_msg("Failed to create PAR client, closing", 1, "circuit")
else:
log_ex(failure, "Unexpected failure while starting circuit")
self.on_done()
示例3: on_failure
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import exception_is_a [as 别名]
def on_failure(reason):
# is this an expected failure for a single UDP reply test?
if Basic.exception_is_a(reason, [CannotListenError, ConnectError, TimeoutError]):
return
# otherwise, log the error
log_ex(reason, "Unexpected failure while testing UDP replies")
示例4: udp_test_failure
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import exception_is_a [as 别名]
def udp_test_failure(reason):
if Basic.exception_is_a(reason, [TimeoutError]):
return False
log_ex(reason, "Unexpected failure while testing UDP")
return None