From 9ccbda0ebd51d493542db7e48746a50a07a27003 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Fri, 23 Apr 2021 09:01:59 +0300 Subject: [PATCH] Use exceptionally instead of handle in SQLDB The wrong method was in use for error handling completable future --- .../java/com/djrapitops/plan/storage/database/SQLDB.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/SQLDB.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/SQLDB.java index d7ea86e14..bb411fb60 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/SQLDB.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/SQLDB.java @@ -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, Throwable, CompletableFuture> errorHandler(Transaction transaction, Exception origin) { - return (obj, throwable) -> { + private Function> errorHandler(Transaction transaction, Exception origin) { + return throwable -> { if (throwable == null) { return CompletableFuture.completedFuture(null); }