Don't log MessageExceptions as error for prefix/suffix

This commit is contained in:
Vankka 2023-07-21 17:10:36 +03:00
parent 3040b1472c
commit 9eb4160bc6
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0

View File

@ -21,6 +21,7 @@ package com.discordsrv.common.permission.util;
import com.discordsrv.api.module.type.PermissionDataProvider;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.component.util.ComponentUtil;
import com.discordsrv.common.exception.MessageException;
import net.kyori.adventure.text.Component;
import java.util.UUID;
@ -76,7 +77,12 @@ public final class PermissionUtil {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
discordSRV.logger().error("Failed to lookup " + what, e.getCause());
Throwable cause = e.getCause();
if (cause instanceof MessageException) {
discordSRV.logger().debug("Failed to lookup " + what + ": " + cause.getMessage());
} else {
discordSRV.logger().debug("Failed to lookup " + what, cause);
}
}
return translate(discordSRV, data);
}