Added a custom error that wraps failure::Error to add error possibilities for API consumers.
This commit is contained in:
parent
4509336d74
commit
c78770f763
1 changed files with 11 additions and 1 deletions
12
src/error.rs
12
src/error.rs
|
@ -3,6 +3,7 @@
|
||||||
use std::io::Error as IoError;
|
use std::io::Error as IoError;
|
||||||
use std::sync::mpsc::RecvError;
|
use std::sync::mpsc::RecvError;
|
||||||
|
|
||||||
|
use failure;
|
||||||
use futures::sync::mpsc::SendError;
|
use futures::sync::mpsc::SendError;
|
||||||
use futures::sync::oneshot::Canceled;
|
use futures::sync::oneshot::Canceled;
|
||||||
use native_tls::Error as TlsError;
|
use native_tls::Error as TlsError;
|
||||||
|
@ -94,7 +95,16 @@ pub enum IrcError {
|
||||||
|
|
||||||
/// All specified nicknames were in use or unusable.
|
/// All specified nicknames were in use or unusable.
|
||||||
#[fail(display = "none of the specified nicknames were usable")]
|
#[fail(display = "none of the specified nicknames were usable")]
|
||||||
NoUsableNick
|
NoUsableNick,
|
||||||
|
|
||||||
|
/// This allows you to produce any `failure::Error` within closures used by
|
||||||
|
/// the irc crate. No errors of this kind will ever be produced by the crate
|
||||||
|
/// itself.
|
||||||
|
#[fail(display = "{}", inner)]
|
||||||
|
Custom {
|
||||||
|
/// The actual error that occurred.
|
||||||
|
inner: failure::Error
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Errors that occur when parsing messages.
|
/// Errors that occur when parsing messages.
|
||||||
|
|
Loading…
Add table
Reference in a new issue