Fluke/dbus refactor

This commit is contained in:
Luke Jones
2023-12-03 20:44:01 +00:00
parent f6e4cc0626
commit 0a69c23288
143 changed files with 5421 additions and 10343 deletions

View File

@@ -1,5 +1,8 @@
use std::fmt;
use log::error;
use zbus::fdo::Error as FdoErr;
#[derive(Debug)]
pub enum ProfileError {
Path(String, std::io::Error),
@@ -48,6 +51,17 @@ impl std::error::Error for ProfileError {}
impl From<std::io::Error> for ProfileError {
fn from(err: std::io::Error) -> Self {
error!("ProfileError: got: {err}");
ProfileError::Io(err)
}
}
impl From<ProfileError> for FdoErr {
fn from(error: ProfileError) -> Self {
error!("ProfileError: got: {error}");
match error {
ProfileError::NotSupported => FdoErr::NotSupported("".to_owned()),
_ => FdoErr::Failed(format!("Failed with {error}")),
}
}
}