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
#[derive(Debug)]
/// The general error type for h2o, convertible from
/// std::io::Error, serde_json::Error
pub struct Error {
    kind: String,
    message: String,
}

impl From<serde_json::Error> for Error {
    fn from(error: serde_json::Error) -> Self {
        Error {
            kind: String::from("serde_json"),
            message: error.to_string(),
        }
    }
}

impl From<std::io::Error> for Error {
    fn from(error: std::io::Error) -> Self {
        Error {
            kind: String::from("std::io"),
            message: error.to_string(),
        }
    }
}