diff --git a/azalea-protocol/src/packets/login/c_login_disconnect.rs b/azalea-protocol/src/packets/login/c_login_disconnect.rs index a0e50aa43..580bfb2c2 100755 --- a/azalea-protocol/src/packets/login/c_login_disconnect.rs +++ b/azalea-protocol/src/packets/login/c_login_disconnect.rs @@ -4,6 +4,7 @@ use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError}; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundLoginPacket; use serde::{Deserialize, Serialize}; +use tracing::trace; #[derive(Clone, Debug, ClientboundLoginPacket)] pub struct ClientboundLoginDisconnect { @@ -13,7 +14,16 @@ pub struct ClientboundLoginDisconnect { impl AzaleaRead for ClientboundLoginDisconnect { fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { let disconnect_string = String::azalea_read(buf)?; - let disconnect_json: serde_json::Value = serde_json::from_str(disconnect_string.as_str())?; + trace!("Got disconnect packet with string: {disconnect_string:?}"); + let disconnect_json = + match serde_json::from_str::(disconnect_string.as_str()) { + Ok(json) => json, + Err(err) => { + return Err(BufReadError::Custom(format!( + "Failed to deserialize disconnect JSON {disconnect_string:?}: {err}" + ))) + } + }; Ok(ClientboundLoginDisconnect { reason: FormattedText::deserialize(disconnect_json)?,