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
error_chain!{
    foreign_links {
        Io(::std::io::Error);
        Utf8(::std::string::FromUtf8Error);
        Set(::std::sync::mpsc::SendError<::xcb::Atom>);
        XcbConn(::xcb::base::ConnError);
        XcbGeneric(::xcb::base::GenericError);
    }

    errors {
        Lock {
            description("store lock poison")
        }
        Timeout {
            description("load selection timeout")
        }
        SetOwner {
            description("set selection owner fail")
        }
    }
}

macro_rules! err {
    ( $kind:ident ) => {
        $crate::error::Error::from($crate::error::ErrorKind::$kind)
    };
    ( $kind:ident, $err:expr ) => {
        $crate::error::Error::from($crate::error::ErrorKind::$kind($err))
    };
}