From 8a23b98ce50eca02716b2de5f19f1e706f40e7ae Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:11:54 +0300 Subject: [PATCH] Don't throw errors on placeholder request Affects issues: - Fixed #3682 --- .../djrapitops/plan/placeholder/PlanPlaceholders.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/placeholder/PlanPlaceholders.java b/Plan/common/src/main/java/com/djrapitops/plan/placeholder/PlanPlaceholders.java index a3bdfb1aa..d85d24972 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/placeholder/PlanPlaceholders.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/placeholder/PlanPlaceholders.java @@ -24,6 +24,7 @@ import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.utilities.dev.Untrusted; +import net.playeranalytics.plugin.server.PluginLogger; import org.jetbrains.annotations.Nullable; import javax.inject.Inject; @@ -54,15 +55,18 @@ public final class PlanPlaceholders { private final DBSystem dbSystem; private final Identifiers identifiers; + private final PluginLogger logger; @Inject public PlanPlaceholders( DBSystem dbSystem, Set placeholderRegistries, - Identifiers identifiers + Identifiers identifiers, + PluginLogger logger ) { this.dbSystem = dbSystem; this.identifiers = identifiers; + this.logger = logger; this.playerPlaceholders = new HashMap<>(); this.staticPlaceholders = new HashMap<>(); @@ -118,7 +122,8 @@ public final class PlanPlaceholders { if (dbSystem.getDatabase().getState() == Database.State.CLOSED) { return "Plan Bug #3020, please report"; } - throw e; + logger.warn("Failed to get data for placeholder '" + placeholder + "', " + e.getMessage(), e); + return "db error"; } }