use crate::transport::error::TransportError;
use crate::{Errorizable, TightBeamError};
#[derive(Errorizable, Debug)]
pub enum ClusterError {
#[error("Lock poisoned")]
LockPoisoned,
#[error("Unknown servlet type: {:#?}")]
UnknownServletType(Vec<u8>),
#[error("No hives available for servlet type: {:#?}")]
NoHivesAvailable(Vec<u8>),
#[error("Connect failed")]
ConnectFailed,
#[error("No response")]
NoResponse,
#[error("Transport error: {0}")]
#[from]
#[source]
Transport(TransportError),
#[error("Frame error: {0}")]
#[from]
#[source]
Frame(TightBeamError),
#[error("Malformed response")]
MalformedResponse,
#[error("Registration failed")]
RegistrationFailed,
#[error("Invalid address: {:#?}")]
InvalidAddress(Vec<u8>),
#[error("Servlet not owned by hive")]
ServletNotOwned,
#[error("Signer does not match hive binding")]
SignerMismatch,
}
impl<T> From<std::sync::PoisonError<T>> for ClusterError {
fn from(_: std::sync::PoisonError<T>) -> Self {
ClusterError::LockPoisoned
}
}