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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use std::{self, fmt, error};
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct TryFromIntError { }
impl TryFromIntError {
fn description(&self) -> &str {
"out of range integral type conversion attempted"
}
}
impl fmt::Display for TryFromIntError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self.description().fmt(fmt)
}
}
impl error::Error for TryFromIntError {
fn description(&self) -> &str {
self.description()
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct CharTryFromError { }
impl CharTryFromError {
fn description(&self) -> &str {
"converted integer out of range for `char`"
}
}
impl fmt::Display for CharTryFromError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.description().fmt(f)
}
}
impl error::Error for CharTryFromError {
fn description(&self) -> &str {
self.description()
}
}
error_chain! {
types {
Error, ErrorKind, ResultExt;
}
foreign_links {
Io(std::io::Error);
FromUtf8(std::string::FromUtf8Error);
FromNulError(std::ffi::NulError);
TryFromIntError(TryFromIntError);
CharTryFromError(CharTryFromError);
UuidParseError(::uuid::Error) #[cfg(feature = "uuid")];
}
errors {
UnknownPacketId {
description("unknown packet identifier")
display("unknown packet identifier")
}
UnknownEnumDiscriminator(type_name: &'static str, discriminator: String) {
description("received unknown enum discriminator")
display("received unknown enum discriminator '{}' for type '{}'", discriminator, type_name)
}
UnimplementedParcel(type_name: &'static str) {
description("unimplemented parcel")
display("unimplemented parcel type '{}'", type_name)
}
}
}