Skip to content

Commit

Permalink
handle it properly
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Jan 15, 2024
1 parent 4c35a8a commit 3a111e7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions azalea-client/src/raw_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ pub enum WritePacketError {
},
#[error(transparent)]
Encoding(#[from] azalea_protocol::write::PacketEncodeError),
#[error("io error")]
Io,
#[error(transparent)]
IoError {
#[from]
#[backtrace]
source: std::io::Error,
},
}

impl RawConnection {
Expand Down Expand Up @@ -110,7 +114,12 @@ impl RawConnection {
) -> Result<(), WritePacketError> {
let raw_packet = serialize_packet(&packet)?;
self.write_raw_packet(raw_packet)
.map_err(|_| WritePacketError::Io)?;
.map_err(|_| WritePacketError::IoError {
source: std::io::Error::new(
std::io::ErrorKind::Other,
"Couldn't send packet to server",
),
})?;

Ok(())
}
Expand Down

0 comments on commit 3a111e7

Please sign in to comment.