interledger_packet/
errors.rs

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