use codec::{Decode, Encode};
use mixnet::core::PostErr;
#[derive(Debug, thiserror::Error, Decode, Encode)]
pub enum RemoteErr {
#[error("{0}")]
Other(String),
#[error("Failed to decode the request: {0}")]
Decode(String),
}
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error(
"Failed to communicate with the mixnet service; the node probably needs to be restarted"
)]
ServiceUnavailable,
#[error("Did not receive a reply from the mixnet after the configured number of attempts")]
NoReply,
#[error("Received a malformed reply from the mixnet")]
BadReply,
#[error("Failed to post the request to the mixnet: {0}")]
Post(#[from] PostErr),
#[error("Error reported by the destination mixnode: {0}")]
Remote(#[from] RemoteErr),
}