Don't throw errors on placeholder request

Affects issues:
- Fixed #3682
This commit is contained in:
Aurora Lahtela 2024-07-01 10:11:54 +03:00
parent 511b41eb68
commit 8a23b98ce5

View File

@ -24,6 +24,7 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
import com.djrapitops.plan.utilities.dev.Untrusted; import com.djrapitops.plan.utilities.dev.Untrusted;
import net.playeranalytics.plugin.server.PluginLogger;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
@ -54,15 +55,18 @@ public final class PlanPlaceholders {
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final Identifiers identifiers; private final Identifiers identifiers;
private final PluginLogger logger;
@Inject @Inject
public PlanPlaceholders( public PlanPlaceholders(
DBSystem dbSystem, DBSystem dbSystem,
Set<Placeholders> placeholderRegistries, Set<Placeholders> placeholderRegistries,
Identifiers identifiers Identifiers identifiers,
PluginLogger logger
) { ) {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.identifiers = identifiers; this.identifiers = identifiers;
this.logger = logger;
this.playerPlaceholders = new HashMap<>(); this.playerPlaceholders = new HashMap<>();
this.staticPlaceholders = new HashMap<>(); this.staticPlaceholders = new HashMap<>();
@ -118,7 +122,8 @@ public final class PlanPlaceholders {
if (dbSystem.getDatabase().getState() == Database.State.CLOSED) { if (dbSystem.getDatabase().getState() == Database.State.CLOSED) {
return "Plan Bug #3020, please report"; return "Plan Bug #3020, please report";
} }
throw e; logger.warn("Failed to get data for placeholder '" + placeholder + "', " + e.getMessage(), e);
return "db error";
} }
} }