本文整理汇总了Python中rx.core.Observable.catch_exception方法的典型用法代码示例。如果您正苦于以下问题:Python Observable.catch_exception方法的具体用法?Python Observable.catch_exception怎么用?Python Observable.catch_exception使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.core.Observable
的用法示例。
在下文中一共展示了Observable.catch_exception方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: catch_exception
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import catch_exception [as 别名]
def catch_exception(self, second=None, handler=None):
"""Continues an observable sequence that is terminated by an exception
with the next observable sequence.
1 - xs.catch_exception(ys)
2 - xs.catch_exception(lambda ex: ys(ex))
Keyword arguments:
handler -- Exception handler function that returns an observable
sequence given the error that occurred in the first sequence.
second -- Second observable sequence used to produce results when an
error occurred in the first sequence.
Returns an observable sequence containing the first sequence's
elements, followed by the elements of the handler sequence in case an
exception occurred.
"""
if handler or not isinstance(second, Observable):
return catch_handler(self, handler or second)
return Observable.catch_exception([self, second])