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
32
33
34
35
36
37
38
39
40
41
42
43
use std::error::Error;
use std::fmt;
#[derive(Debug)]
pub enum OutputError {
CouldNotSet,
CouldNotGet,
CouldNotUnset,
}
impl fmt::Display for OutputError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
OutputError::CouldNotSet => write!(f, "Could not set Output"),
OutputError::CouldNotGet => write!(f, "Could not get Output"),
OutputError::CouldNotUnset => write!(f, "Could not unset Output"),
}
}
}
impl Error for OutputError {
fn description(&self) -> &str {
match *self {
OutputError::CouldNotSet => "Could not set Output",
OutputError::CouldNotGet => "Could not get Output",
OutputError::CouldNotUnset => "Could not unset Output",
}
}
fn cause(&self) -> Option<&Error> {
match *self {
OutputError::CouldNotSet => None,
OutputError::CouldNotGet => None,
OutputError::CouldNotUnset => None,
}
}
}