ilp_packet/
errors.rs

1use std;
2use std::str::Utf8Error;
3use std::string::FromUtf8Error;
4use chrono;
5
6quick_error! {
7    #[derive(Debug)]
8    pub enum ParseError {
9        Io(err: std::io::Error) {
10            from()
11            description(err.description())
12            cause(err)
13        }
14        Utf8(err: Utf8Error) {
15            from()
16            description(err.description())
17            cause(err)
18        }
19        FromUtf8(err: FromUtf8Error) {
20            from()
21            description(err.description())
22            cause(err)
23        }
24        Chrono(err: chrono::ParseError) {
25            from()
26            description(err.description())
27            cause(err)
28        }
29        WrongType(descr: &'static str) {
30            description(descr)
31            display("Wrong Type {}", descr)
32        }
33        InvalidPacket(descr: &'static str) {
34            description(descr)
35            display("Invalid Packet {}", descr)
36        }
37        Other(err: Box<std::error::Error>) {
38            cause(&**err)
39            description(err.description())
40            display("Error {}", err.description())
41        }
42    }
43}