9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-02 22:02:17 +00:00

Log error on protocol encode & decode fail

This commit is contained in:
Lumine1909
2025-10-07 22:02:12 -07:00
parent c57fe207dd
commit 57e3a3ccdb

View File

@@ -205,7 +205,12 @@ public class LeavesProtocolManager {
if (codec == null) {
return null;
}
return codec.decode(ProtocolUtils.decorate(buf));
try {
return codec.decode(ProtocolUtils.decorate(buf));
} catch (Exception e) {
LOGGER.severe("Failed to decode " + location, e);
throw e;
}
}
public static void encode(FriendlyByteBuf buf, LeavesCustomPayload payload) {
@@ -214,8 +219,13 @@ public class LeavesProtocolManager {
if (location == null || codec == null) {
throw new IllegalArgumentException("Payload " + payload.getClass() + " is not configured correctly " + location + " " + codec);
}
buf.writeResourceLocation(location);
codec.encode(ProtocolUtils.decorate(buf), payload);
try {
buf.writeResourceLocation(location);
codec.encode(ProtocolUtils.decorate(buf), payload);
} catch (Exception e) {
LOGGER.severe("Failed to encode payload " + location, e);
throw e;
}
}
public static void handlePayload(IdentifierSelector selector, LeavesCustomPayload payload) {