This commit is contained in:
veeso
2021-08-10 22:27:20 +02:00
parent 6cfac57162
commit 764cca73d1
19 changed files with 104 additions and 100 deletions

View File

@@ -115,7 +115,7 @@ impl BookmarksClient {
if let Err(e) = key_storage.set_key(service_id, key.as_str()) {
error!("Failed to set new key into storage: {}", e);
return Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
format!("Could not write key to storage: {}", e),
));
}
@@ -125,7 +125,7 @@ impl BookmarksClient {
_ => {
error!("Failed to get key from storage: {}", e);
return Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
format!("Could not get key from storage: {}", e),
));
}
@@ -328,7 +328,7 @@ impl BookmarksClient {
Err(err) => {
error!("Failed to write bookmarks: {}", err);
Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
err.to_string(),
))
}
@@ -358,7 +358,7 @@ impl BookmarksClient {
Err(err) => {
error!("Failed to read bookmarks: {}", err);
Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
err.to_string(),
))
}
@@ -407,7 +407,7 @@ impl BookmarksClient {
match crypto::aes128_b64_decrypt(self.key.as_str(), secret) {
Ok(txt) => Ok(txt),
Err(err) => Err(SerializerError::new_ex(
SerializerErrorKind::SyntaxError,
SerializerErrorKind::Syntax,
err.to_string(),
)),
}

View File

@@ -76,7 +76,7 @@ impl ConfigClient {
if let Err(err) = create_dir(ssh_key_dir) {
error!("Failed to create SSH key dir: {}", err);
return Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
format!(
"Could not create SSH key directory \"{}\": {}",
ssh_key_dir.display(),
@@ -252,7 +252,7 @@ impl ConfigClient {
) -> Result<(), SerializerError> {
if self.degraded {
return Err(SerializerError::new_ex(
SerializerErrorKind::GenericError,
SerializerErrorKind::Generic,
String::from("Configuration won't be saved, since in degraded mode"),
));
}
@@ -291,7 +291,7 @@ impl ConfigClient {
pub fn del_ssh_key(&mut self, host: &str, username: &str) -> Result<(), SerializerError> {
if self.degraded {
return Err(SerializerError::new_ex(
SerializerErrorKind::GenericError,
SerializerErrorKind::Generic,
String::from("Configuration won't be saved, since in degraded mode"),
));
}
@@ -351,7 +351,7 @@ impl ConfigClient {
pub fn write_config(&self) -> Result<(), SerializerError> {
if self.degraded {
return Err(SerializerError::new_ex(
SerializerErrorKind::GenericError,
SerializerErrorKind::Generic,
String::from("Configuration won't be saved, since in degraded mode"),
));
}
@@ -366,7 +366,7 @@ impl ConfigClient {
Err(err) => {
error!("Failed to write configuration file: {}", err);
Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
err.to_string(),
))
}
@@ -379,7 +379,7 @@ impl ConfigClient {
pub fn read_config(&mut self) -> Result<(), SerializerError> {
if self.degraded {
return Err(SerializerError::new_ex(
SerializerErrorKind::GenericError,
SerializerErrorKind::Generic,
String::from("Configuration won't be loaded, since in degraded mode"),
));
}
@@ -401,7 +401,7 @@ impl ConfigClient {
Err(err) => {
error!("Failed to read configuration: {}", err);
Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
err.to_string(),
))
}
@@ -432,7 +432,7 @@ impl ConfigClient {
/// Make serializer error from `std::io::Error`
fn make_io_err(err: std::io::Error) -> Result<(), SerializerError> {
Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
err.to_string(),
))
}

View File

@@ -116,7 +116,7 @@ impl ThemeProvider {
warn!("Configuration won't be loaded, since degraded; reloading default...");
self.theme = Theme::default();
return Err(SerializerError::new_ex(
SerializerErrorKind::GenericError,
SerializerErrorKind::Generic,
String::from("Can't access theme file"),
));
}
@@ -139,7 +139,7 @@ impl ThemeProvider {
Err(err) => {
error!("Failed to read theme: {}", err);
Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
err.to_string(),
))
}
@@ -153,7 +153,7 @@ impl ThemeProvider {
if self.degraded {
warn!("Configuration won't be saved, since in degraded mode");
return Err(SerializerError::new_ex(
SerializerErrorKind::GenericError,
SerializerErrorKind::Generic,
String::from("Can't access theme file"),
));
}
@@ -169,7 +169,7 @@ impl ThemeProvider {
Err(err) => {
error!("Failed to write theme: {}", err);
Err(SerializerError::new_ex(
SerializerErrorKind::IoError,
SerializerErrorKind::Io,
err.to_string(),
))
}