Impl display & debug for ServerError
This commit is contained in:
parent
03d7ac54d1
commit
4a537f4d42
3 changed files with 12 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -411,7 +411,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "usdpl-back"
|
||||
version = "0.1.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"tungstenite",
|
||||
"usdpl-core",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "usdpl-back"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
license = "GPL-3.0-only"
|
||||
repository = "https://github.com/NGnius/usdpl-rs"
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
#[derive(Debug)]
|
||||
pub enum ServerError {
|
||||
Tungstenite(tungstenite::error::Error),
|
||||
Io(std::io::Error),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ServerError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Tungstenite(t) => (&t as &dyn std::fmt::Display).fmt(f),
|
||||
Self::Io(io) => (&io as &dyn std::fmt::Display).fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type ServerResult = Result<(), ServerError>;
|
||||
|
|
Loading…
Reference in a new issue