本文整理汇总了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;
};
}
示例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);
}
}
示例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);
}
}
示例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;
};
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
}
};
}