aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorhozan23 <hozan23@proton.me>2023-11-18 00:54:09 +0300
committerhozan23 <hozan23@proton.me>2023-11-18 00:54:09 +0300
commitce82eb571b0f48a59f3a94cf61af9ccd1beea438 (patch)
treebd8ce05fade23455033d878a2781991af3326fa8 /net
parentf04ba793bbc15d021444c5010aaf0e4bae655ce0 (diff)
clean up error module and use `transparent` attribute
Diffstat (limited to 'net')
-rw-r--r--net/src/error.rs14
1 files changed, 4 insertions, 10 deletions
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<T> = std::result::Result<T, Error>;
#[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<T> From<smol::channel::SendError<T>> for Error {
Error::ChannelSend(error.to_string())
}
}
-
-impl From<smol::channel::RecvError> for Error {
- fn from(error: smol::channel::RecvError) -> Self {
- Error::ChannelRecv(error.to_string())
- }
-}