Source:
<code>public Subscriber<? super T> call(final Subscriber<? super R> child) { return new Subscriber<T>(child) { private final R initialValue = initialValueFactory.call(); private R value = initialValue; boolean initialized = false; @SuppressWarnings("unchecked") @Override public void onNext(T currentValue) { emitInitialValueIfNeeded(child); if (this.value == NO_INITIAL_VALUE) { this.value = (R) currentValue; } else { try { this.value = accumulator.call(this.value, currentValue); } catch (Throwable e) { child.onError(OnErrorThrowable.addValueAsLastCause(e, currentValue)); <START> return; <END> } } child.onNext(this.value); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onCompleted() { emitInitialValueIfNeeded(child); child.onCompleted(); } private void emitInitialValueIfNeeded(final Subscriber<? super R> child) { if (!initialized) { initialized = true; if (initialValue != NO_INITIAL_VALUE) { child.onNext(initialValue); } } } @Override public void setProducer(final Producer producer) { child.setProducer(new Producer() { final AtomicBoolean once = new AtomicBoolean(); final AtomicBoolean excessive = new AtomicBoolean(); @Override public void request(long n) { if (once.compareAndSet(false, true)) { if (initialValue == NO_INITIAL_VALUE || n == Long.MAX_VALUE) { producer.request(n); } else if (n == 1) { excessive.set(true); producer.request(1); } else { producer.request(n - 1); } } else { if (n > 1 && excessive.compareAndSet(true, false) && n != Long.MAX_VALUE) { producer.request(n - 1); } else { producer.request(n); } } } }); } }; }</code><technical_language>Good catch. add Exceptions.throwIfFatal(e); child.onError OperatorMap</technical_language>

Target:
public Subscriber<? super T> call(final Subscriber<? super R> child) { return new Subscriber<T>(child) { private final R initialValue = initialValueFactory.call(); private R value = initialValue; boolean initialized = false; @SuppressWarnings("unchecked") @Override public void onNext(T currentValue) { emitInitialValueIfNeeded(child); if (this.value == NO_INITIAL_VALUE) { this.value = (R) currentValue; } else { try { this.value = accumulator.call(this.value, currentValue); } catch (Throwable e) { Exceptions.throwIfFatal(e); child.onError(OnErrorThrowable.addValueAsLastCause(e, currentValue)); return; } } child.onNext(this.value); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onCompleted() { emitInitialValueIfNeeded(child); child.onCompleted(); } private void emitInitialValueIfNeeded(final Subscriber<? super R> child) { if (!initialized) { initialized = true; if (initialValue != NO_INITIAL_VALUE) { child.onNext(initialValue); } } } @Override public void setProducer(final Producer producer) { child.setProducer(new Producer() { final AtomicBoolean once = new AtomicBoolean(); final AtomicBoolean excessive = new AtomicBoolean(); @Override public void request(long n) { if (once.compareAndSet(false, true)) { if (initialValue == NO_INITIAL_VALUE || n == Long.MAX_VALUE) { producer.request(n); } else if (n == 1) { excessive.set(true); producer.request(1); } else { producer.request(n - 1); } } else { if (n > 1 && excessive.compareAndSet(true, false) && n != Long.MAX_VALUE) { producer.request(n - 1); } else { producer.request(n); } } } }); } }; }