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
use crate::error::Error;
#[derive(Debug, Clone)]
pub enum ControllerError {
PulseCtl(String),
GetInfo(String),
}
impl std::fmt::Display for ControllerError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::PulseCtl(e) => f.write_str(&format!("PulseCtl error: {}", e)),
Self::GetInfo(e) => f.write_str(&format!("GetInfo error: {}", e)),
}
}
}
impl std::error::Error for ControllerError {}
impl From<Error> for ControllerError {
fn from(error: Error) -> Self {
Self::PulseCtl(error.to_string())
}
}