Skip to content

Commit 5a681c0

Browse files
author
VictoremWinbringer
committed
added better Dysplay for Exception
1 parent 205d3d0 commit 5a681c0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "victorem"
3-
version = "0.7.0"
3+
version = "0.7.1"
44
edition = "2018"
55
description = "UPD Game Server Framework"
66
license = "MIT"

src/entities.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub enum Exception {
3535
BadProtocolVersion,
3636
///Error on serialize or deserialize
3737
BincodeError(bincode::Error),
38-
/// Not ordered command or state come by this reason it was skipped.
38+
/// Not ordered command or state received by this reason it was skipped.
3939
/// Maybe it is duplicated.
4040
/// Retry again.
4141
NotOrderedPacketError,
@@ -49,7 +49,12 @@ impl Error for Exception {}
4949

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

0 commit comments

Comments
 (0)