1use crate::authority::Authorization;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum NoosphereError {
9 #[error("{0}")]
11 Other(anyhow::Error),
12
13 #[allow(missing_docs)]
14 #[error("Network access required but network is currently offline")]
15 NetworkOffline,
16
17 #[allow(missing_docs)]
18 #[error("No credentials configured")]
19 NoCredentials,
20
21 #[allow(missing_docs)]
22 #[error("Missing configuration: {0}")]
23 MissingConfiguration(&'static str),
24
25 #[allow(missing_docs)]
26 #[error("The provided authorization {0} is invalid: {1}")]
27 InvalidAuthorization(Authorization, String),
28
29 #[allow(missing_docs)]
30 #[error("The gateway gave an unexpected or malformed response. {0}")]
31 UnexpectedGatewayResponse(String),
32}
33
34impl From<anyhow::Error> for NoosphereError {
35 fn from(error: anyhow::Error) -> Self {
36 NoosphereError::Other(error)
37 }
38}