mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-23 17:47:38 +01:00
Use exceptionally instead of handle in SQLDB
The wrong method was in use for error handling completable future
This commit is contained in:
parent
bd7336b411
commit
9ccbda0ebd
@ -47,7 +47,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
@ -261,11 +261,11 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
accessLock.checkAccess(transaction);
|
||||
transaction.executeTransaction(this);
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}, getTransactionExecutor()).handle(errorHandler(transaction, origin));
|
||||
}, getTransactionExecutor()).exceptionally(errorHandler(transaction, origin));
|
||||
}
|
||||
|
||||
private BiFunction<CompletableFuture<Object>, Throwable, CompletableFuture<Object>> errorHandler(Transaction transaction, Exception origin) {
|
||||
return (obj, throwable) -> {
|
||||
private Function<Throwable, CompletableFuture<Object>> errorHandler(Transaction transaction, Exception origin) {
|
||||
return throwable -> {
|
||||
if (throwable == null) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user