当前位置: 首页>>代码示例>>Python>>正文


Python Observable.catch_exception方法代码示例

本文整理汇总了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])
开发者ID:JohnWowUs,项目名称:RxPY,代码行数:24,代码来源:catch.py


注:本文中的rx.core.Observable.catch_exception方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。