memcached_protocal/error.rs
1use std;
2
3
4error_chain! {
5 // The type defined for this error. These are the conventional
6 // and recommended names, but they can be arbitrarily chosen.
7 types {
8 Error, ErrorKind, ChainErr, Result;
9 }
10
11 // Automatic conversions between this error chain and other
12 // error chains. In this case, it will e.g. generate an
13 // `ErrorKind` variant called `Dist` which in turn contains
14 // the `rustup_dist::ErrorKind`, with conversions from
15 // `rustup_dist::Error`.
16 //
17 // This section can be empty.
18 links {
19 }
20
21 // Automatic conversions between this error chain and other
22 // error types not defined by the `error_chain!`. These will be
23 // boxed as the error cause and wrapped in a new error with,
24 // in this case, the `ErrorKind::Temp` variant.
25 //
26 // This section can be empty.
27 foreign_links {
28 std::io::Error, StdIO, "stdio error";
29 std::string::FromUtf8Error, FromUtf8Error, "from utf8 error";
30 std::num::ParseIntError, ParseIntError, "parse int error";
31 }
32
33 // Define additional `ErrorKind` variants. The syntax here is
34 // the same as `quick_error!`, but the `from()` and `cause()`
35 // syntax is not supported.
36 errors {
37 Error {
38 description("not a command")
39 display("not a command")
40 }
41 ClientError(e: String) {
42 description("client error")
43 display("client error: {}", e)
44 }
45 ServerError(e: String) {
46 description("server error")
47 display("server error: {}", e)
48 }
49 }
50}