From ce82eb571b0f48a59f3a94cf61af9ccd1beea438 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Sat, 18 Nov 2023 00:54:09 +0300 Subject: clean up error module and use `transparent` attribute --- net/src/error.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'net/src') diff --git a/net/src/error.rs b/net/src/error.rs index a1c85db..346184a 100644 --- a/net/src/error.rs +++ b/net/src/error.rs @@ -4,7 +4,7 @@ pub type Result = std::result::Result; #[derive(ThisError, Debug)] pub enum Error { - #[error("IO Error: {0}")] + #[error(transparent)] IO(#[from] std::io::Error), #[error("Try from endpoint Error")] @@ -25,10 +25,10 @@ pub enum Error { #[error("Channel Send Error: {0}")] ChannelSend(String), - #[error("Channel Receive Error: {0}")] - ChannelRecv(String), + #[error(transparent)] + ChannelRecv(#[from] smol::channel::RecvError), - #[error("Karyons core error : {0}")] + #[error(transparent)] KaryonsCore(#[from] karyons_core::error::Error), } @@ -37,9 +37,3 @@ impl From> for Error { Error::ChannelSend(error.to_string()) } } - -impl From for Error { - fn from(error: smol::channel::RecvError) -> Self { - Error::ChannelRecv(error.to_string()) - } -} -- cgit v1.2.3