This commit is contained in:
Andrea Cavalli 2021-04-18 23:29:10 +02:00
parent 4df3cb1b84
commit b59e23b03e
2 changed files with 3 additions and 9 deletions

View File

@ -44,6 +44,7 @@ public class ResponseError extends IOException {
this.code = 500;
this.message = cause.getMessage();
this.cause = cause;
this.initCause(cause);
}
public ResponseError(@NotNull String tag, @NotNull String botName, @NotNull Throwable cause) {
@ -53,6 +54,7 @@ public class ResponseError extends IOException {
this.code = 500;
this.message = cause.getMessage();
this.cause = cause;
this.initCause(cause);
}
public static ResponseError newResponseError(@NotNull Function function, @NotNull String botName, @NotNull TdApi.Error cause) {

View File

@ -2,7 +2,6 @@ package it.tdlight.tdlibsession.td;
import it.tdlight.common.ReactiveTelegramClient;
import it.tdlight.jni.TdApi;
import it.tdlight.jni.TdApi.Error;
import it.tdlight.utils.MonoUtils;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@ -47,14 +46,7 @@ public class WrappedReactorTelegramClient implements ReactorTelegramClient {
*/
@Override
public Mono<TdApi.Object> send(TdApi.Function query) {
return Flux.from(reactiveTelegramClient.send(query)).single().handle((item, sink) -> {
if (item.getConstructor() == Error.CONSTRUCTOR) {
var error = ((TdApi.Error) item);
sink.error(new TdError(error.code, error.message));
} else {
sink.next(item);
}
});
return Mono.from(reactiveTelegramClient.send(query)).single();
}
/**