@Override public void onFailure(Call<T> call, Throwable t) { Exceptions.throwIfFatal(t); arbiter.emitError(t); } });
private void emitOnError(Throwable error) { Exceptions.throwIfFatal(error); if (!subscriber.isUnsubscribed()) { subscriber.onError(error); } else { LOGGER.debug("Not propagating onError after unsubscription: {}", error.getMessage(), error); } } }
@Override public void onError(Response<T> response) { Throwable throwable = response.getException(); Exceptions.throwIfFatal(throwable); arbiter.emitError(throwable); }
private ListenerInvocationException handleListenerError(ListenerInvocationException exception, ListenerHolder<T> listener, Throwable e) { Exceptions.throwIfFatal(e); if (null == exception) { exception = new ListenerInvocationException(); } exception.addException(listener.delegate, e); return exception; }
private void emitResponse(List<Response<T>> responseList) { try { synchronized (this) { Iterator<Response<T>> iterator = responseList.iterator(); while (iterator.hasNext()) { Response<T> next = iterator.next(); iterator.remove(); if (!isUnsubscribed()) { subscriber.onNext(next); } else { return; } } } } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaHooks.getOnError().call(e); } catch (Throwable t) { Exceptions.throwIfFatal(t); try { subscriber.onError(t); } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaHooks.getOnError().call(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaHooks.getOnError().call(new CompositeException(t, inner)); } } }
@Override public void onNext(Response<R> response) { if (response.isSuccessful()) { subscriber.onNext(response.body()); } else { subscriberTerminated = true; Throwable t = new HttpException(response); try { subscriber.onError(t); } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); CompositeException composite = new CompositeException(t, inner); RxJavaPlugins.getInstance().getErrorHandler().handleError(composite); } } }
@Override public void onError(Throwable throwable) { try { subscriber.onNext(Result.<R>error(throwable)); } catch (Throwable t) { try { subscriber.onError(t); } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); CompositeException composite = new CompositeException(t, inner); RxJavaPlugins.getInstance().getErrorHandler().handleError(composite); } return; } subscriber.onCompleted(); }
@Override public void call(Subscriber<? super Response<T>> subscriber) { // Since Call is a one-shot type, clone it for each new subscriber. Call<T> call = originalCall.clone(); CallArbiter<T> arbiter = new CallArbiter<>(call, subscriber); subscriber.add(arbiter); subscriber.setProducer(arbiter); Response<T> response; try { response = call.execute(); } catch (Throwable t) { Exceptions.throwIfFatal(t); arbiter.emitError(t); return; } arbiter.emitResponse(response); } }
@Override public void call(Subscriber<? super T> subscriber) { try { LazyList<T> lazyList = query.forCurrentThread().listLazyUncached(); try { for (T entity : lazyList) { if (subscriber.isUnsubscribed()) { break; } subscriber.onNext(entity); } } finally { lazyList.close(); } if (!subscriber.isUnsubscribed()) { subscriber.onCompleted(); } } catch (Throwable e) { Exceptions.throwIfFatal(e); subscriber.onError(e); } } });
return; } catch (Throwable t) { Exceptions.throwIfFatal(t); try { subscriber.onError(t); RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); CompositeException composite = new CompositeException(t, inner); RxJavaPlugins.getInstance().getErrorHandler().handleError(composite); RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } catch (Throwable t) { Exceptions.throwIfFatal(t); RxJavaPlugins.getInstance().getErrorHandler().handleError(t);
@Override public void onError(Throwable throwable) { try { subscriber.onNext(Result.<R>error(throwable)); } catch (Throwable t) { try { subscriber.onError(t); } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaHooks.getOnError().call(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaHooks.getOnError().call(new CompositeException(t, inner)); } return; } subscriber.onCompleted(); }
void emitComplete() { set(STATE_TERMINATED); try { if (!isUnsubscribed()) { subscriber.onCompleted(); } } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaHooks.getOnError().call(e); } catch (Throwable t) { Exceptions.throwIfFatal(t); RxJavaHooks.getOnError().call(t); } }
void emitError(Throwable t) { set(STATE_TERMINATED); if (!isUnsubscribed()) { try { subscriber.onError(t); } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); CompositeException composite = new CompositeException(t, inner); RxJavaPlugins.getInstance().getErrorHandler().handleError(composite); } } } }
@Override public void onNext(Response<R> response) { if (response.isSuccessful()) { subscriber.onNext(response.body()); } else { subscriberTerminated = true; Throwable t = new HttpException(response); try { subscriber.onError(t); } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaHooks.getOnError().call(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaHooks.getOnError().call(new CompositeException(t, inner)); } } }
void emitError(Throwable t) { set(STATE_TERMINATED); if (!isUnsubscribed()) { try { subscriber.onError(t); } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaHooks.getOnError().call(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaHooks.getOnError().call(new CompositeException(t, inner)); } } } }
@Override public void call(Subscriber<? super Response<T>> subscriber) { // Since Call is a one-shot type, clone it for each new subscriber. Call<T> call = originalCall.clone(); CallArbiter<T> arbiter = new CallArbiter<>(call, subscriber); subscriber.add(arbiter); subscriber.setProducer(arbiter); Response<T> response; try { response = call.execute(); } catch (Throwable t) { Exceptions.throwIfFatal(t); arbiter.emitError(t); return; } arbiter.emitNext(response); arbiter.emitComplete(); } }
Exceptions.throwIfFatal(e); if (!subscriber.isUnsubscribed()) { subscriber.onError(Utils.getErrorForConnection(new ANError(e)));
Exceptions.throwIfFatal(e); if (!subscriber.isUnsubscribed()) { subscriber.onError(Utils.getErrorForConnection(new ANError(e)));
Exceptions.throwIfFatal(e); if (!subscriber.isUnsubscribed()) { subscriber.onError(Utils.getErrorForConnection(new ANError(e)));
protected ListenerInvocationException handleListenerError(ListenerInvocationException exception, SafeListener<? extends E> listener, Throwable e) { Exceptions.throwIfFatal(e); if (null == exception) { exception = new ListenerInvocationException(); } exception.addException(listener.delegate, e); return exception; }