Java Code Examples for io.reactivex.exceptions.Exceptions#throwIfFatal()
The following examples show how to use
io.reactivex.exceptions.Exceptions#throwIfFatal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowableStateMachine.java From rxjava2-extras with Apache License 2.0 | 6 votes |
private boolean createdState() { if (state == null) { try { state = ObjectHelper.requireNonNull(initialState.call(), "initial state cannot be null"); return true; } catch (Throwable e) { Exceptions.throwIfFatal(e); done = true; onError_(e); return false; } } else { return true; } }
Example 2
Source File: LifeConditionalSubscriber.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { if (isDisposed()) { RxJavaPlugins.onError(t); return; } lazySet(SubscriptionHelper.CANCELLED); try { removeObserver(); downstream.onError(t); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, e)); } }
Example 3
Source File: LifeSingleObserver.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onSubscribe(Disposable d) { if (DisposableHelper.setOnce(this, d)) { try { addObserver(); downstream.onSubscribe(d); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); d.dispose(); onError(ex); } } }
Example 4
Source File: CallEnqueueObservable.java From okhttp-OkGo with Apache License 2.0 | 5 votes |
@Override public void onFinish() { if (call.isCanceled()) return; try { terminated = true; observer.onComplete(); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaPlugins.onError(inner); } }
Example 5
Source File: BodyObservable.java From okhttp-OkGo with Apache License 2.0 | 5 votes |
@Override public void onNext(Response<R> response) { if (response.isSuccessful()) { observer.onNext(response.body()); } else { terminated = true; Throwable t = new HttpException(response); try { observer.onError(t); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaPlugins.onError(new CompositeException(t, inner)); } } }
Example 6
Source File: LifeCompletableObserver.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onSubscribe(Disposable d) { if (DisposableHelper.setOnce(this, d)) { try { addObserver(); downstream.onSubscribe(d); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); d.dispose(); onError(ex); } } }
Example 7
Source File: OperatorCountZeroOrNot.java From sqlitemagic with Apache License 2.0 | 5 votes |
@Override public void onNext(Query<Long> query) { try { // returns null every time, but is needed for transaction checks final Cursor cursor = query.rawQuery(true); final Long count = query.map(cursor); if (!isDisposed()) { downstream.onNext(count > 0 ^ countZero ? Boolean.TRUE : Boolean.FALSE); } } catch (Throwable e) { Exceptions.throwIfFatal(e); onError(e); } }
Example 8
Source File: ResultObservable.java From retrocache with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable throwable) { try { mObserver.onNext(Result.<R>error(throwable)); } catch (Throwable t) { try { mObserver.onError(t); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaPlugins.onError(new CompositeException(t, inner)); } return; } mObserver.onComplete(); }
Example 9
Source File: LifeMaybeObserver.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onSuccess(T t) { if (isDisposed()) return; lazySet(DisposableHelper.DISPOSED); try { removeObserver(); downstream.onSuccess(t); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaPlugins.onError(ex); } }
Example 10
Source File: LifeMaybeObserver.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onSubscribe(Disposable d) { if (DisposableHelper.setOnce(this, d)) { try { addObserver(); downstream.onSubscribe(d); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); d.dispose(); onError(ex); } } }
Example 11
Source File: LifeSingleObserver.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onSuccess(T t) { if (isDisposed()) return; lazySet(DisposableHelper.DISPOSED); try { removeObserver(); downstream.onSuccess(t); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(e); } }
Example 12
Source File: LifeConditionalSubscriber.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onNext(T t) { if (isDisposed()) return; try { downstream.onNext(t); } catch (Throwable e) { Exceptions.throwIfFatal(e); get().cancel(); onError(e); } }
Example 13
Source File: MyLambdaSubscriber.java From RxBus with Apache License 2.0 | 5 votes |
@Override public void onComplete() { if (get() != SubscriptionHelper.CANCELLED) { lazySet(SubscriptionHelper.CANCELLED); try { onComplete.run(); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(e); } } }
Example 14
Source File: FlowableOnBackpressureBufferToFile.java From rxjava2-extras with Apache License 2.0 | 5 votes |
public void onNext(T t) { try { queue.offer(serializer.serialize(t)); } catch (Throwable e) { Exceptions.throwIfFatal(e); onError(e); return; } scheduleDrain(); }
Example 15
Source File: LifeObserver.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { if (isDisposed()) { RxJavaPlugins.onError(t); return; } lazySet(DisposableHelper.DISPOSED); try { removeObserver(); downstream.onError(t); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, e)); } }
Example 16
Source File: LifeObserver.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onNext(T t) { if (isDisposed()) return; try { downstream.onNext(t); } catch (Throwable e) { Exceptions.throwIfFatal(e); get().dispose(); onError(e); } }
Example 17
Source File: CallExecuteObservable.java From okhttp-OkGo with Apache License 2.0 | 5 votes |
@Override protected void subscribeActual(Observer<? super Response<T>> observer) { // Since Call is a one-shot type, clone it for each new observer. Call<T> call = originalCall.clone(); observer.onSubscribe(new CallDisposable(call)); boolean terminated = false; try { Response<T> response = call.execute(); if (!call.isCanceled()) { observer.onNext(response); } if (!call.isCanceled()) { terminated = true; observer.onComplete(); } } catch (Throwable t) { Exceptions.throwIfFatal(t); if (terminated) { RxJavaPlugins.onError(t); } else if (!call.isCanceled()) { try { observer.onError(t); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaPlugins.onError(new CompositeException(t, inner)); } } } }
Example 18
Source File: FlowableOnBackpressureBufferToFile.java From rxjava2-extras with Apache License 2.0 | 5 votes |
@VisibleForTesting public static void close(PagedQueue queue) { try { queue.close(); } catch (Throwable err) { Exceptions.throwIfFatal(err); RxJavaPlugins.onError(err); } }
Example 19
Source File: LifeSubscriber.java From rxjava-RxLife with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { if (isDisposed()) { RxJavaPlugins.onError(t); return; } lazySet(SubscriptionHelper.CANCELLED); try { removeObserver(); downstream.onError(t); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, e)); } }
Example 20
Source File: CallEnqueueObservable.java From retrocache with Apache License 2.0 | 5 votes |
@Override public void onResponse(Call<T> call, Response<T> response) { if (call.isCanceled()) { return; } if (mCachingActive) { mCachingSystem.put( CacheUtils.urlToKey(call.request().url()), CacheUtils.responseToBytes(mRetrofit, response, mResponseType, mAnnotations)); } try { mObserver.onNext(response); if (!call.isCanceled()) { mTerminated = true; mObserver.onComplete(); } } catch (Throwable t) { if (mTerminated) { RxJavaPlugins.onError(t); } else if (!call.isCanceled()) { try { mObserver.onError(t); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaPlugins.onError(new CompositeException(t, inner)); } } } }