1use std::fmt;
2
3#[derive(Debug)]
4pub enum Error {
5 KeyNotFound(String),
6 BadFormat(String),
7 SerializeError(String)
8}
9
10impl std::error::Error for Error { }
11
12impl fmt::Display for Error {
13 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
14 match &*self {
15 Error::KeyNotFound(s) => {
16 write!(f, "Parameter '{}' not found", s)
17 }
18 Error::BadFormat(s) => {
19 write!(f, "Bad format; {}", s)
20 }
21 Error::SerializeError(s) => {
22 write!(f, "Unable to serialize; {}", s)
23 }
24 }
25 }
26}
27
28