类com.google.android.gms.tasks.RuntimeExecutionException源码实例Demo

下面列出了怎么用com.google.android.gms.tasks.RuntimeExecutionException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: firebase-android-sdk   文件: StorageTask.java
/**
 * Gets the result of the Task, if it has already completed.
 *
 * @throws IllegalStateException if the Task is not yet complete
 * @throws X if the Task failed with an exception of type X
 * @throws RuntimeExecutionException if the Task failed with an exception that was not of type X
 */
@NonNull
@Override
public <X extends Throwable> ResultT getResult(@NonNull Class<X> exceptionType) throws X {
  if (getFinalResult() == null) {
    throw new IllegalStateException();
  }
  if (exceptionType.isInstance(getFinalResult().getError())) {
    throw exceptionType.cast(getFinalResult().getError());
  }
  Throwable t = getFinalResult().getError();
  if (t != null) {
    throw new RuntimeExecutionException(t);
  }
  return getFinalResult();
}
 
源代码2 项目: firebase-android-sdk   文件: StorageTask.java
/**
 * Gets the result of the Task, if it has already completed.
 *
 * @throws IllegalStateException if the Task is not yet complete
 * @throws RuntimeExecutionException if the Task failed with an exception
 */
@NonNull
@Override
public ResultT getResult() {
  if (getFinalResult() == null) {
    throw new IllegalStateException();
  }
  Throwable t = getFinalResult().getError();
  if (t != null) {
    throw new RuntimeExecutionException(t);
  }
  return getFinalResult();
}
 
源代码3 项目: FirebaseUI-Android   文件: AutoCompleteTask.java
@Override
public TResult getResult() {
    if (mSuccess) {
        return mResult;
    } else {
        throw new RuntimeExecutionException(mException);
    }
}
 
源代码4 项目: FirebaseUI-Android   文件: AutoCompleteTask.java
private static Exception unwrap(Exception e) {
    if (e instanceof RuntimeExecutionException && e.getCause() instanceof Exception) {
        return (Exception) e.getCause();
    }
    return e;
}