Skip to content

Commit

Permalink
added better Dysplay for Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
VictoremWinbringer committed Jan 4, 2019
1 parent 205d3d0 commit 5a681c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "victorem"
version = "0.7.0"
version = "0.7.1"
edition = "2018"
description = "UPD Game Server Framework"
license = "MIT"
Expand Down
9 changes: 7 additions & 2 deletions src/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub enum Exception {
BadProtocolVersion,
///Error on serialize or deserialize
BincodeError(bincode::Error),
/// Not ordered command or state come by this reason it was skipped.
/// Not ordered command or state received by this reason it was skipped.
/// Maybe it is duplicated.
/// Retry again.
NotOrderedPacketError,
Expand All @@ -49,7 +49,12 @@ impl Error for Exception {}

impl Display for Exception {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
write!(f, "{:#?}", self)
match self {
Exception::BadProtocolVersion => write!(f, "Different lib version on client and server. You must update client and server."),
Exception::NotOrderedPacketError => write!(f, "Not ordered command or state received by this reason it was skipped. Maybe it is duplicated. Retry again."),
Exception::NotValidIdError => write!(f, "Packet not from this lib. Lib ignoring it. Retry again."),
_ => write!(f, "{:#?}", self),
}
}
}

Expand Down

0 comments on commit 5a681c0

Please sign in to comment.