本文整理汇总了Java中io.reactivex.exceptions.Exceptions.throwIfFatal方法的典型用法代码示例。如果您正苦于以下问题:Java Exceptions.throwIfFatal方法的具体用法?Java Exceptions.throwIfFatal怎么用?Java Exceptions.throwIfFatal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.exceptions.Exceptions
的用法示例。
在下文中一共展示了Exceptions.throwIfFatal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNext
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public void onNext(Response<R> response) {
if (response.isSuccessful()) {
if (response.body() != null) {
observer.onNext(response.body());
} else {
observer.onComplete();
}
} else {
terminated = true;
Throwable t = new HttpException(response);
try {
observer.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaPlugins.onError(new CompositeException(t, inner));
}
}
}
示例2: onComplete
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public void onComplete(@NonNull Task<T> task) {
if (isDisposed()) return;
if (task.isSuccessful()) {
T result = task.getResult();
if (result == null) {
observer.onComplete();
} else {
observer.onSuccess(result);
}
} else {
try {
observer.onError(task.getException());
} catch (Throwable t) {
Exceptions.throwIfFatal(t);
RxJavaPlugins.onError(new CompositeException(task.getException(), t));
}
}
}
示例3: subscribe
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public void subscribe(ObservableEmitter<T> subscriber) throws Exception {
try {
T data = execute();
if (!subscriber.isDisposed() && data != null) {
subscriber.onNext(data);
}
} catch (Throwable e) {
ViseLog.e(e);
Exceptions.throwIfFatal(e);
if (!subscriber.isDisposed()) {
subscriber.onError(e);
}
return;
}
if (!subscriber.isDisposed()) {
subscriber.onComplete();
}
}
示例4: subscribeActual
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@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));
}
}
}
}
示例5: onError
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override public void onError(Throwable throwable) {
try {
observer.onNext(Result.<R>error(throwable));
} catch (Throwable t) {
try {
observer.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaPlugins.onError(new CompositeException(t, inner));
}
return;
}
observer.onComplete();
}
示例6: onError
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public void onError(Response<T> response) {
if (call.isCanceled()) return;
Throwable throwable = response.getException();
try {
terminated = true;
observer.onError(throwable);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaPlugins.onError(new CompositeException(throwable, inner));
}
}
示例7: onFailure
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override public void onFailure(Call<T> call, Throwable t) {
if (call.isCanceled()) return;
try {
observer.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaPlugins.onError(new CompositeException(t, inner));
}
}
示例8: onFinish
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public void onFinish() {
if (call.isCanceled()) return;
try {
terminated = true;
observer.onComplete();
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaPlugins.onError(inner);
}
}
示例9: onError
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public void onError(Throwable throwable) {
try {
observer.onNext(Result.<R>error(throwable));
} catch (Throwable t) {
try {
observer.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaPlugins.onError(new CompositeException(t, inner));
}
return;
}
observer.onComplete();
}
示例10: onComplete
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public void onComplete(@NonNull Task<Void> task) {
if (isDisposed()) return;
if (task.isSuccessful()) {
observer.onComplete();
} else {
try {
observer.onError(task.getException());
} catch (Throwable t) {
Exceptions.throwIfFatal(t);
RxJavaPlugins.onError(new CompositeException(task.getException(), t));
}
}
}
示例11: subscribeActual
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@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));
}
}
}
}
示例12: onNext
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@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));
}
}
}
示例13: run
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public void run() {
Runnable r = get();
if (r != null && compareAndSet(r, null)) {
try {
r.run();
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
RxJavaPlugins.onError(ex);
}
}
}
示例14: call
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public T call() throws Exception {
try {
return ((Callable<T>)source).call();
} catch (Exception ex) {
Exceptions.throwIfFatal(ex);
throw (Exception)assembled.appendLast(ex);
}
}
示例15: onNext
import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override public void onNext(SqlBrite.Query query) {
try {
T item = null;
Cursor cursor = query.run();
if (cursor != null) {
try {
if (cursor.moveToNext()) {
item = mapper.apply(cursor);
if (item == null) {
downstream.onError(new NullPointerException("QueryToOne mapper returned null"));
return;
}
if (cursor.moveToNext()) {
throw new IllegalStateException("Cursor returned more than 1 row");
}
}
} finally {
cursor.close();
}
}
if (!isDisposed()) {
if (item != null) {
downstream.onNext(item);
} else if (defaultValue != null) {
downstream.onNext(defaultValue);
}
}
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
onError(e);
}
}