Add more debug info in packet parsing errors

For diagnosing #710 and other future packet parsing errors
This commit is contained in:
ORelio 2019-04-27 21:04:13 +02:00
parent c04b17cabc
commit 9841156130

View file

@ -401,6 +401,8 @@ namespace MinecraftClient.Protocol.Handlers
/// <param name="packetData">Packet contents</param>
/// <returns>TRUE if the packet was processed, FALSE if ignored or unknown</returns>
private bool handlePacket(int packetID, List<byte> packetData)
{
try
{
if (login_phase)
{
@ -854,6 +856,18 @@ namespace MinecraftClient.Protocol.Handlers
}
return true; //Packet processed
}
catch (Exception innerException)
{
throw new System.IO.InvalidDataException(
String.Format("Failed to process incoming packet of type {0}. (PacketID: {1}, Protocol: {2}, LoginPhase: {3}, InnerException: {4}).",
getPacketIncomingType(packetID, protocolversion),
packetID,
protocolversion,
login_phase,
innerException.GetType()),
innerException);
}
}
/// <summary>
/// Process chunk column data from the server and (un)load the chunk from the Minecraft world