@Test public void supplierCrash() { TestSubscriber<Object> ts = new TestSubscriber<>(); Multi.range(1, 5) .reduce(() -> { throw new IllegalArgumentException(); }, Integer::sum) .subscribe(ts); ts.assertFailure(IllegalArgumentException.class); }
@Override public void subscribe(Flow.Subscriber<? super R> subscriber) { R initial; try { initial = Objects.requireNonNull(supplier.get(), "The supplier returned a null item"); } catch (Throwable ex) { subscriber.onSubscribe(EmptySubscription.INSTANCE); subscriber.onError(ex); return; } source.subscribe(new ReduceFullSubscriber<>(subscriber, initial, reducer)); }
MultiReduceFull extends CompletionSingle<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { R initial; try { initial = Objects.requireNonNull(supplier.get(), "The supplier returned a null item"); } catch (Throwable ex) { subscriber.onSubscribe(EmptySubscription.INSTANCE); subscriber.onError(ex); return; } source.subscribe(new ReduceFullSubscriber<>(subscriber, initial, reducer)); } }
MultiReduceFull extends CompletionSingle<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { R initial; try { initial = Objects.requireNonNull(supplier.get(), "The supplier returned a null item"); } catch (Throwable ex) { subscriber.onSubscribe(EmptySubscription.INSTANCE); subscriber.onError(ex); return; } source.subscribe(new ReduceFullSubscriber<>(subscriber, initial, reducer)); } MultiReduceFull(Multi<T> source, Supplier<? extends R> supplier, BiFunction<R, T, R> reducer); }
MultiReduceFull extends CompletionSingle<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { R initial; try { initial = Objects.requireNonNull(supplier.get(), "The supplier returned a null item"); } catch (Throwable ex) { subscriber.onSubscribe(EmptySubscription.INSTANCE); subscriber.onError(ex); return; } source.subscribe(new ReduceFullSubscriber<>(subscriber, initial, reducer)); } MultiReduceFull(Multi<T> source, Supplier<? extends R> supplier, BiFunction<R, T, R> reducer); @Override void subscribe(Flow.Subscriber<? super R> subscriber); }
MultiReduceFull extends CompletionSingle<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { R initial; try { initial = Objects.requireNonNull(supplier.get(), "The supplier returned a null item"); } catch (Throwable ex) { subscriber.onSubscribe(EmptySubscription.INSTANCE); subscriber.onError(ex); return; } source.subscribe(new ReduceFullSubscriber<>(subscriber, initial, reducer)); } MultiReduceFull(Multi<T> source, Supplier<? extends R> supplier, BiFunction<R, T, R> reducer); @Override void subscribe(Flow.Subscriber<? super R> subscriber);  }