use crate::authority::Authorization;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum NoosphereError {
#[error("{0}")]
Other(anyhow::Error),
#[allow(missing_docs)]
#[error("Network access required but network is currently offline")]
NetworkOffline,
#[allow(missing_docs)]
#[error("No credentials configured")]
NoCredentials,
#[allow(missing_docs)]
#[error("Missing configuration: {0}")]
MissingConfiguration(&'static str),
#[allow(missing_docs)]
#[error("The provided authorization {0} is invalid: {1}")]
InvalidAuthorization(Authorization, String),
#[allow(missing_docs)]
#[error("The gateway gave an unexpected or malformed response. {0}")]
UnexpectedGatewayResponse(String),
}
impl From<anyhow::Error> for NoosphereError {
fn from(error: anyhow::Error) -> Self {
NoosphereError::Other(error)
}
}