use microservices::{esb, rpc};
use crate::ServiceId;
#[derive(Debug, Display, From, Error)]
#[display(doc_comments)]
#[non_exhaustive]
pub enum Error {
#[from]
Esb(esb::Error<ServiceId>),
#[from]
Rpc(rpc::Error),
#[display(inner)]
#[from(internet2::addr::NoOnionSupportError)]
Other(String),
}
impl From<Error> for esb::Error<ServiceId> {
fn from(err: Error) -> Self {
match err {
Error::Esb(err) => err,
err => esb::Error::ServiceError(err.to_string()),
}
}
}
impl From<Error> for rpc::Error {
fn from(err: Error) -> Self {
match err {
Error::Rpc(err) => err,
err => rpc::Error::ServerFailure(rpc::Failure { code: 2000, info: err.to_string() }),
}
}
}