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


Java Exceptions.propagate方法代码示例

本文整理汇总了Java中io.reactivex.exceptions.Exceptions.propagate方法的典型用法代码示例。如果您正苦于以下问题:Java Exceptions.propagate方法的具体用法?Java Exceptions.propagate怎么用?Java Exceptions.propagate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.reactivex.exceptions.Exceptions的用法示例。


在下文中一共展示了Exceptions.propagate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleExecuteErrors

import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
static <T> Function<BaseResponse<T>, BaseResponse<T>> handleExecuteErrors(String... expectedMethods) {
    if (expectedMethods.length == 0) {
        throw new IllegalArgumentException("No expected methods found");
    }

    return response -> {
        if (nonEmpty(response.executeErrors)) {
            for (Error error : response.executeErrors) {
                for (String expectedMethod : expectedMethods) {
                    if (expectedMethod.equalsIgnoreCase(error.method)) {
                        throw Exceptions.propagate(new ApiException(error));
                    }
                }
            }
        }

        return response;
    };
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:20,代码来源:AbsApi.java

示例2: callRequireNonNull

import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
static Scheduler callRequireNonNull(Callable<Scheduler> s) {
    try {
        Scheduler scheduler = s.call();
        if (scheduler == null) {
            throw new NullPointerException("Scheduler Callable returned null");
        }
        return scheduler;
    } catch (Throwable ex) {
        throw Exceptions.propagate(ex);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:RxAndroidPlugins.java

示例3: apply

import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
static <T, R> R apply(Function<T, R> f, T t) {
    try {
        return f.apply(t);
    } catch (Throwable ex) {
        throw Exceptions.propagate(ex);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:RxAndroidPlugins.java

示例4: extractResponseWithErrorHandling

import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
static <T> Function<BaseResponse<T>, T> extractResponseWithErrorHandling() {
    return response -> {
        if (nonNull(response.error)) {
            throw Exceptions.propagate(new ApiException(response.error));
        }

        return response.response;
    };
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:10,代码来源:AbsApi.java

示例5: getDataSnapshotTypedValue

import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
private static <U> U getDataSnapshotTypedValue(DataSnapshot dataSnapshot, Class<U> clazz) {
   U value = dataSnapshot.getValue(clazz);
   if (value == null) {
      throw Exceptions.propagate(new RxFirebaseDataCastException(
         "unable to cast firebase data response to " + clazz.getSimpleName()));
   }
   return value;
}
 
开发者ID:DVT,项目名称:showcase-android,代码行数:9,代码来源:DataSnapshotMapper.java

示例6: apply

import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public U apply(DataSnapshot dataSnapshot) {
   if (dataSnapshot.exists()) {
      U value = dataSnapshot.getValue(genericTypeIndicator);
      if (value == null) {
         throw Exceptions.propagate(new RxFirebaseDataCastException(
            "unable to cast firebase data response to generic type"));
      }
      return value;
   } else {
      return null;
   }
}
 
开发者ID:DVT,项目名称:showcase-android,代码行数:14,代码来源:DataSnapshotMapper.java

示例7: apply

import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
@Override
public Boolean apply(Throwable throwable) throws Exception {
    if (throwable instanceof OutsideLifecycleException) {
        return true;
    }

    //noinspection ThrowableResultOfMethodCallIgnored
    Exceptions.propagate(throwable);
    return false;
}
 
开发者ID:xufreshman,项目名称:RxLifeCycle,代码行数:11,代码来源:Functions.java

示例8: merge

import io.reactivex.exceptions.Exceptions; //导入方法依赖的package包/类
private static Function<List<Entry>, Entry> merge() {
  return new Function<List<Entry>, Entry>() {
    @Override
    public Entry apply(List<Entry> entries) throws Exception {
      Entry oldEntry = entries.get(0);
      Entry newEntry = entries.get(1);

      boolean isNew = oldEntry == null;
      if (isNew) {
        return newEntry;
      }

      try {
        JtsMvt oldMvt = MvtDecoder.decode(oldEntry.getVector());
        JtsMvt newMvt = MvtDecoder.decode(newEntry.getVector());
        JtsMvt toReturn = new JtsMvt(oldMvt.getLayers());

        // apply new data
        for (JtsLayer layer : newMvt.getLayers()) {
          if (toReturn.getLayer(layer.getName()) == null) {
            toReturn.getLayersByName().put(layer.getName(), layer);
          } else {
            toReturn.getLayer(layer.getName()).getGeometries().addAll(layer.getGeometries());
          }
        }

        // create replacement vector tile
        return new Entry(oldEntry.getZoomLevel(), oldEntry.getColumn(), oldEntry.getRow(),
            MvtEncoder.encode(toReturn));
      } catch (IOException exception) {
        throw Exceptions.propagate(exception);
      }
    }
  };
}
 
开发者ID:OrdnanceSurvey,项目名称:vt-support,代码行数:36,代码来源:DataSource.java


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