diff --git a/Cargo.lock b/Cargo.lock index fcbd3f6..bc6bdf4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -411,7 +411,7 @@ dependencies = [ [[package]] name = "usdpl-back" -version = "0.1.0" +version = "0.2.1" dependencies = [ "tungstenite", "usdpl-core", diff --git a/usdpl-back/Cargo.toml b/usdpl-back/Cargo.toml index 9080157..4f077f7 100644 --- a/usdpl-back/Cargo.toml +++ b/usdpl-back/Cargo.toml @@ -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" diff --git a/usdpl-back/src/errors.rs b/usdpl-back/src/errors.rs index 96fbded..38906fd 100644 --- a/usdpl-back/src/errors.rs +++ b/usdpl-back/src/errors.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>;