determine blobstore path and mount blob file server

This commit is contained in:
2022-02-23 11:54:08 +02:00
parent a37288225a
commit 9013ccb3d6
4 changed files with 70 additions and 23 deletions

View File

@ -9,21 +9,25 @@ use serde_yaml::Error as YamlError;
/// Custom error type encapsulating all possible errors for the web application.
#[derive(Debug)]
pub enum PeachWebError {
Golgi(GolgiError),
Json(JsonError),
Yaml(YamlError),
FailedToRegisterDynDomain(String),
Golgi(GolgiError),
HomeDir,
Json(JsonError),
OsString,
PeachLib { source: PeachError, msg: String },
Yaml(YamlError),
}
impl std::error::Error for PeachWebError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match *self {
PeachWebError::Golgi(ref source) => Some(source),
PeachWebError::Json(ref source) => Some(source),
PeachWebError::Yaml(ref source) => Some(source),
PeachWebError::FailedToRegisterDynDomain(_) => None,
PeachWebError::Golgi(ref source) => Some(source),
PeachWebError::HomeDir => None,
PeachWebError::Json(ref source) => Some(source),
PeachWebError::OsString => None,
PeachWebError::PeachLib { ref source, .. } => Some(source),
PeachWebError::Yaml(ref source) => Some(source),
}
}
}
@ -31,13 +35,21 @@ impl std::error::Error for PeachWebError {
impl std::fmt::Display for PeachWebError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
PeachWebError::Golgi(ref source) => write!(f, "Golgi error: {}", source),
PeachWebError::Json(ref source) => write!(f, "Serde JSON error: {}", source),
PeachWebError::Yaml(ref source) => write!(f, "Serde YAML error: {}", source),
PeachWebError::FailedToRegisterDynDomain(ref msg) => {
write!(f, "DYN DNS error: {}", msg)
}
PeachWebError::Golgi(ref source) => write!(f, "Golgi error: {}", source),
PeachWebError::HomeDir => write!(
f,
"Filesystem error: failed to determine home directory path"
),
PeachWebError::Json(ref source) => write!(f, "Serde JSON error: {}", source),
PeachWebError::OsString => write!(
f,
"Filesystem error: failed to convert OsString to String for go-ssb directory path"
),
PeachWebError::PeachLib { ref source, .. } => write!(f, "{}", source),
PeachWebError::Yaml(ref source) => write!(f, "Serde YAML error: {}", source),
}
}
}
@ -54,12 +66,6 @@ impl From<JsonError> for PeachWebError {
}
}
impl From<YamlError> for PeachWebError {
fn from(err: YamlError) -> PeachWebError {
PeachWebError::Yaml(err)
}
}
impl From<PeachError> for PeachWebError {
fn from(err: PeachError) -> PeachWebError {
PeachWebError::PeachLib {
@ -68,3 +74,9 @@ impl From<PeachError> for PeachWebError {
}
}
}
impl From<YamlError> for PeachWebError {
fn from(err: YamlError) -> PeachWebError {
PeachWebError::Yaml(err)
}
}