rx/operators/observable/catch.py
def catch_exception_(*args) -> ObservableBase:
    """Continues an observable sequence that is terminated by an
    exception with the next observable sequence.

    1 - res = Observable.catch_exception(xs, ys, zs)
    2 - res = Observable.catch_exception([xs, ys, zs])

    Returns an observable sequence containing elements from consecutive
    source sequences until a source sequence terminates successfully.
    """

    if isinstance(args[0], list) or isinstance(args[0], Iterable):
        sources = args[0]
    else:
        sources = list(args)

    def subscribe(observer, scheduler=None):
        scheduler = scheduler or current_thread_scheduler

        subscription = SerialDisposable()
        cancelable = SerialDisposable()
        last_exception = [None]
        is_disposed = []
        e = iter(sources)

        def action(action1, state=None):
            def on_error(exn):
                last_exception[0] = exn
                cancelable.disposable = scheduler.schedule(action)

            if is_disposed:
                return

            try:
                current = next(e)
            except StopIteration:
                if last_exception[0]:
                    observer.on_error(last_exception[0])
                else:
                    observer.on_completed()
            except Exception as ex:
                observer.on_error(ex)
            else:
                d = SingleAssignmentDisposable()
                subscription.disposable = d
                d.disposable = current.subscribe_(observer.on_next, on_error, observer.on_completed, scheduler)

        cancelable.disposable = scheduler.schedule(action)

        def dispose():
            is_disposed.append(True)
        return CompositeDisposable(subscription, cancelable, Disposable.create(dispose))
    return AnonymousObservable(subscribe)
Continues an observable sequence that is terminated by an
    exception with the next observable sequence.

    1 - res = Observable.catch_exception(xs, ys, zs)
    2 - res = Observable.catch_exception([xs, ys, zs])

    Returns an observable sequence containing elements from consecutive
    source sequences until a source sequence terminates successfully.
    
Continues an observable sequence that is terminated by an
exception with the next observable sequence.



Returns an observable sequence containing elements from consecutive
source sequences until a source sequence terminates successfully.
Continues an observable sequence that is terminated by an exception with the next observable sequence . Returns an observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully .
def catch_exception_(*args) -> ObservableBase:
    if isinstance(args[0], list) or isinstance(args[0], Iterable):
        sources = args[0]
    else:
        sources = list(args)
    def subscribe(observer, scheduler=None):
        scheduler = scheduler or current_thread_scheduler
        subscription = SerialDisposable()
        cancelable = SerialDisposable()
        last_exception = [None]
        is_disposed = []
        e = iter(sources)
        def action(action1, state=None):
            def on_error(exn):
                last_exception[0] = exn
                cancelable.disposable = scheduler.schedule(action)
            if is_disposed:
                return
            try:
                current = next(e)
            except StopIteration:
                if last_exception[0]:
                    observer.on_error(last_exception[0])
                else:
                    observer.on_completed()
            except Exception as ex:
                observer.on_error(ex)
            else:
                d = SingleAssignmentDisposable()
                subscription.disposable = d
                d.disposable = current.subscribe_(observer.on_next, on_error, observer.on_completed, scheduler)
        cancelable.disposable = scheduler.schedule(action)
        def dispose():
            is_disposed.append(True)
        return CompositeDisposable(subscription, cancelable, Disposable.create(dispose))
    return AnonymousObservable(subscribe)
def catch_exception_ ( * args ) -> ObservableBase : if isinstance ( args [ 0 ] , list ) or isinstance ( args [ 0 ] , Iterable ) : sources = args [ 0 ] else : sources = list ( args ) def subscribe ( observer , scheduler = None ) : scheduler = scheduler or current_thread_scheduler subscription = SerialDisposable ( ) cancelable = SerialDisposable ( ) last_exception = [ None ] is_disposed = [ ] e = iter ( sources ) def action ( action1 , state = None ) : def on_error ( exn ) : last_exception [ 0 ] = exn cancelable . disposable = scheduler . schedule ( action ) if is_disposed : return try : current = next ( e ) except StopIteration : if last_exception [ 0 ] : observer . on_error ( last_exception [ 0 ] ) else : observer . on_completed ( ) except Exception as ex : observer . on_error ( ex ) else : d = SingleAssignmentDisposable ( ) subscription . disposable = d d . disposable = current . subscribe_ ( observer . on_next , on_error , observer . on_completed , scheduler ) cancelable . disposable = scheduler . schedule ( action ) def dispose ( ) : is_disposed . append ( True ) return CompositeDisposable ( subscription , cancelable , Disposable . create ( dispose ) ) return AnonymousObservable ( subscribe )
Continues an observable sequence that is terminated by an
exception with the next observable sequence.
Continues an observable sequence that is terminated by an exception with the next observable sequence .
"""Continues an observable sequence that is terminated by an
    exception with the next observable sequence.

    1 - res = Observable.catch_exception(xs, ys, zs)
    2 - res = Observable.catch_exception([xs, ys, zs])

    Returns an observable sequence containing elements from consecutive
    source sequences until a source sequence terminates successfully.
    """