Update MonoUtils.java
This commit is contained in:
parent
6fd5b099c3
commit
cb1d0dfe3a
@ -151,6 +151,14 @@ public class MonoUtils {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T extends TdApi.Object> Mono<T> orElseLogSkipError(TdResult<T> optional) {
|
||||||
|
if (optional.failed()) {
|
||||||
|
logger.error("Received TDLib error: {}", optional.cause());
|
||||||
|
return Mono.empty();
|
||||||
|
}
|
||||||
|
return Mono.just(optional.result());
|
||||||
|
}
|
||||||
|
|
||||||
public static <T extends TdApi.Object> Mono<Void> thenOrLogRepeatError(Supplier<? extends Mono<TdResult<T>>> optionalMono) {
|
public static <T extends TdApi.Object> Mono<Void> thenOrLogRepeatError(Supplier<? extends Mono<TdResult<T>>> optionalMono) {
|
||||||
return Mono.defer(() -> optionalMono.get().handle((TdResult<T> optional, SynchronousSink<Void> sink) -> {
|
return Mono.defer(() -> optionalMono.get().handle((TdResult<T> optional, SynchronousSink<Void> sink) -> {
|
||||||
if (optional.succeeded()) {
|
if (optional.succeeded()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user