1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use dbus_async::DBusError;
use std::fmt::{self, Display, Formatter};
#[derive(Debug)]
pub enum Error {
DBusError(DBusError),
InvalidResponse,
UnsupportedCapability,
}
impl Display for Error {
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
match self {
Error::DBusError(error) => Display::fmt(error, formatter),
Error::InvalidResponse => formatter.write_str("Invalid response from daemon"),
Error::UnsupportedCapability => formatter.write_str("Unsupported capablity"),
}
}
}
impl std::error::Error for Error {}
impl From<DBusError> for Error {
fn from(error: DBusError) -> Self {
Self::DBusError(error)
}
}