Java 类io.reactivex.internal.util.ExceptionHelper 实例源码

项目:RxJava2Extensions    文件:NonoTest.java   
void checkNoNext(Function<Nono, Nono> mapper) {
    try {
        mapper.apply(new Nono() {
            @Override
            protected void subscribeActual(Subscriber<? super Void> s) {
                s.onSubscribe(new BooleanSubscription());
                s.onNext(null);
                s.onComplete();
            }
        })
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult();
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}
项目:RxJava2Swing    文件:RxSwingPlugins.java   
public static Runnable onSchedule(Runnable run) {
    Function<Runnable, Runnable> f = onSchedule;
    if (f == null) {
        return run;
    }
    try {
        return f.apply(run);
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}
项目:RxJava2Swing    文件:RxSwingPlugins.java   
public static Scheduler onEdtScheduler(Scheduler original) {
    Function<Scheduler, Scheduler> f = onEdtScheduler;
    if (f == null) {
        return original;
    }
    try {
        return f.apply(original);
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}
项目:RxJava2Swing    文件:RxSwingPlugins.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> Observable<T> onAssembly(Observable<T> original) {
    Function<Observable, Observable> f = onAssembly;
    if (f == null) {
        return original;
    }
    try {
        return f.apply(original);
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}
项目:RxJava2Extensions    文件:Perhaps.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
protected static <T> Perhaps<T> onAssembly(Perhaps<T> source) {
    Function<Perhaps, Perhaps> f = onAssembly;
    if (f == null) {
        return source;
    }
    try {
        return f.apply(source);
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}
项目:RxJava2Extensions    文件:Perhaps.java   
/**
 * Applies the function, fluently to this Perhaps and returns the value it returns.
 * @param <R> the result type
 * @param converter the function receiving this Perhaps and returns a value to be returned
 * @return the value returned by the function
 */
public final <R> R to(Function<? super Perhaps<T>, R> converter) {
    try {
        return converter.apply(this);
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}
项目:RxJava2Extensions    文件:Solo.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
protected static <T> Solo<T> onAssembly(Solo<T> source) {
    Function<Solo, Solo> f = onAssembly;
    if (f == null) {
        return source;
    }
    try {
        return f.apply(source);
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}
项目:RxJava2Extensions    文件:Solo.java   
/**
 * Applies the function, fluently to this Solo and returns the value it returns.
 * @param <R> the result type
 * @param converter the function receiving this Solo and returns a value to be returned
 * @return the value returned by the function
 */
public final <R> R to(Function<? super Solo<T>, R> converter) {
    try {
        return converter.apply(this);
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}
项目:akarnokd-misc    文件:IObservable.java   
default T last() {
    class Last implements IObserver<T> {
        T item;

        Throwable error;

        @Override
        public void onSubscribe(IDisposable d) {
        }

        @Override
        public void onNext(T element) {
            item = element;
        }

        @Override
        public void onError(Throwable cause) {
            error = cause;
        }

        @Override
        public void onComplete() {
        }
    }

    Last f = new Last();
    subscribe(f);
    if (f.error != null) {
        throw ExceptionHelper.wrapOrThrow(f.error);
    }
    if (f.item == null) {
        throw new NoSuchElementException();
    }
    return f.item;
}
项目:akarnokd-misc    文件:ResourceFlowable.java   
public final <R> R to(Function<? super ResourceFlowable<T>, ? extends R> composer) {
    try {
        return composer.apply(this);
    } catch (Throwable ex) {
        throw ExceptionHelper.wrapOrThrow(ex);
    }
}