本文整理汇总了Python中vispy.util.event.EventEmitter.print_callback_errors方法的典型用法代码示例。如果您正苦于以下问题:Python EventEmitter.print_callback_errors方法的具体用法?Python EventEmitter.print_callback_errors怎么用?Python EventEmitter.print_callback_errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vispy.util.event.EventEmitter
的用法示例。
在下文中一共展示了EventEmitter.print_callback_errors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_emitter_error_handling
# 需要导入模块: from vispy.util.event import EventEmitter [as 别名]
# 或者: from vispy.util.event.EventEmitter import print_callback_errors [as 别名]
def test_emitter_error_handling(self):
"""Emitter error handling"""
em = EventEmitter(type='test_event')
em.print_callback_errors = False
def cb(ev):
raise Exception('test')
# first callback fails; second callback still runs.
em.connect(self.record_event)
em.connect(cb)
self.result = None
ev = em()
self.assert_result(event=ev)
# this time we should get an exception
self.result = None
em.ignore_callback_errors = False
try:
em()
assert False, "Emission should have raised exception"
except Exception as err:
if str(err) != 'test':
raise