当前位置: 首页>>代码示例>>Java>>正文


Java Exceptions.throwIfFatal方法代码示例

本文整理汇总了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));
        }
    }
}
 
开发者ID:octaware,项目名称:super-volley,代码行数:20,代码来源:BodyObservable.java

示例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));
        }
    }
}
 
开发者ID:niqo01,项目名称:RxTask,代码行数:20,代码来源:MaybeTaskCallback.java

示例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();
    }
}
 
开发者ID:xiaoyaoyou1212,项目名称:XSnow,代码行数:20,代码来源:ApiCache.java

示例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));
      }
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:CallExecuteObservable.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:ResultObservable.java

示例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));
    }
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:14,代码来源:CallEnqueueObservable.java

示例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));
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:CallEnqueueObservable.java

示例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);
    }

}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:14,代码来源:CallEnqueueObservable.java

示例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();
}
 
开发者ID:octaware,项目名称:super-volley,代码行数:16,代码来源:ResultObservable.java

示例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));
        }
    }
}
 
开发者ID:niqo01,项目名称:RxTask,代码行数:15,代码来源:CompletableTaskCallback.java

示例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));
            }
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:CallExecuteObservable.java

示例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));
        }
    }
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:16,代码来源:BodyObservable.java

示例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);
        }
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Swing,代码行数:13,代码来源:AsyncSwingScheduler.java

示例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);
    }
}
 
开发者ID:akaita,项目名称:RxJava2Debug,代码行数:11,代码来源:MaybeOnAssemblyCallable.java

示例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);
  }
}
 
开发者ID:jiechic,项目名称:sqlbrite-sqlcipher,代码行数:33,代码来源:QueryToOneOperator.java


注:本文中的io.reactivex.exceptions.Exceptions.throwIfFatal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。