1use async_std::channel::RecvError;
2use msgpack_rpc::DecodeError;
3use std::io;
4use thiserror::Error;
5
6pub type NetworkResult<T> = Result<T, NetworkError>;
7
8#[derive(Error, Debug)]
9pub enum NetworkError {
10 #[error("received because the channel is empty or closed")]
11 Recv(#[from] RecvError),
12 #[error("issue with read or write I/O operation")]
13 Io(#[from] io::Error),
14 #[error("Could not send message: {message}")]
15 Send { message: String },
16 #[error("Could not decode the message that was received")]
17 Decode(#[from] DecodeError),
18}