Skip to content

2.x: Why ObservableFromCallable logic differs from FlowableFromCallable when error occurs #6156

@suribada

Description

@suribada

Currently I see source codes RxJava 2.2.0

        try {
            value = ObjectHelper.requireNonNull(callable.call(), "Callable returned null");
        } catch (Throwable e) {
            Exceptions.throwIfFatal(e);
            if (!d.isDisposed()) {
                s.onError(e);
            } else {
                RxJavaPlugins.onError(e);
            }
            return;
        }

In ObserableFromCallable, if error ocurrs and alreadly disposed, common error handler is used..
But FlowableFromCallable, this logic differs.

        try {
            t = ObjectHelper.requireNonNull(callable.call(), "The callable returned a null value");
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            s.onError(ex);
            return;
        }

In my opinion, it seems that there lacks consistency, but are there reasons?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions