Only print codec netty exceptions

This commit is contained in:
KennyTV 2020-06-14 18:15:09 +02:00
parent b9889d2c45
commit 8d7c7743b8
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 6 additions and 4 deletions

View File

@ -3,10 +3,11 @@ package us.myles.ViaVersion.bukkit.handlers;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.CodecException;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.bukkit.util.NMSUtil;
import us.myles.ViaVersion.exception.CancelDecoderException;
import us.myles.ViaVersion.exception.CancelCodecException;
import us.myles.ViaVersion.exception.CancelDecoderException;
import us.myles.ViaVersion.util.PipelineUtil;
import java.lang.reflect.InvocationTargetException;
@ -56,7 +57,7 @@ public class BukkitDecodeHandler extends ByteToMessageDecoder {
if (PipelineUtil.containsCause(cause, CancelCodecException.class)) return; // ProtocolLib compat
super.exceptionCaught(ctx, cause);
if (!NMSUtil.isDebugPropertySet()) {
if (!NMSUtil.isDebugPropertySet() && PipelineUtil.containsCause(cause, CodecException.class)) {
cause.printStackTrace(); // Print if CB doesn't already do it
}
}

View File

@ -2,11 +2,12 @@ package us.myles.ViaVersion.bukkit.handlers;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.CodecException;
import io.netty.handler.codec.MessageToByteEncoder;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.bukkit.util.NMSUtil;
import us.myles.ViaVersion.exception.CancelEncoderException;
import us.myles.ViaVersion.exception.CancelCodecException;
import us.myles.ViaVersion.exception.CancelEncoderException;
import us.myles.ViaVersion.handlers.ChannelHandlerContextWrapper;
import us.myles.ViaVersion.handlers.ViaHandler;
import us.myles.ViaVersion.util.PipelineUtil;
@ -68,7 +69,7 @@ public class BukkitEncodeHandler extends MessageToByteEncoder implements ViaHand
if (PipelineUtil.containsCause(cause, CancelCodecException.class)) return; // ProtocolLib compat
super.exceptionCaught(ctx, cause);
if (!NMSUtil.isDebugPropertySet()) {
if (!NMSUtil.isDebugPropertySet() && PipelineUtil.containsCause(cause, CodecException.class)) {
cause.printStackTrace(); // Print if CB doesn't already do it
}
}