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
error_chain! {
    foreign_links {
        IoError(::std::io::Error);
        CanceledFutureError(::futures::Canceled);
        DnsParserError(::dns_parser::Error);
    }

    errors {
        DnsPacketBuildError(t: Vec<u8>) {
            description("invalid dns packet")
            display("invalid dns packet: '{:?}'", t)
        }

        ActorNotInitialized {
            description("actor not initialized properly")
            display("actor not initialized properly")
        }

        UninitializedChannelReceiver {
            description("actor not initialized properly")
            display("actor not initialized properly")
        }

        FutureSendError {
            description("error while trying to send message")
            display("error while trying to send message")
        }

        MissingKey {
            description("there is no such key")
            display("there is no such key")
        }

        DoSendError {
            description("cannot send message by do_send")
            display("cannot send message by do_send")
        }

        Mailbox
    }
}

use actix::MailboxError;

impl From<MailboxError> for Error {
    fn from(_: MailboxError) -> Self {
        ErrorKind::Mailbox.into()
    }
}