Fixed irc crate to use irc-proto crate now.
This commit is contained in:
parent
70b7349c24
commit
11f86aedc3
3 changed files with 14 additions and 47 deletions
|
@ -193,7 +193,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close(&mut self) -> Poll<(), Self::SinkError> {
|
fn close(&mut self) -> Poll<(), Self::SinkError> {
|
||||||
self.inner.close()
|
self.inner.close().map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
58
src/error.rs
58
src/error.rs
|
@ -18,6 +18,7 @@ use toml::de::Error as TomlReadError;
|
||||||
use toml::ser::Error as TomlWriteError;
|
use toml::ser::Error as TomlWriteError;
|
||||||
|
|
||||||
use proto::Message;
|
use proto::Message;
|
||||||
|
use proto::error::{ProtocolError, MessageParseError};
|
||||||
|
|
||||||
/// A specialized `Result` type for the `irc` crate.
|
/// A specialized `Result` type for the `irc` crate.
|
||||||
pub type Result<T> = ::std::result::Result<T, IrcError>;
|
pub type Result<T> = ::std::result::Result<T, IrcError>;
|
||||||
|
@ -107,52 +108,6 @@ pub enum IrcError {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Errors that occur when parsing messages.
|
|
||||||
#[derive(Debug, Fail)]
|
|
||||||
pub enum MessageParseError {
|
|
||||||
/// The message was empty.
|
|
||||||
#[fail(display = "empty message")]
|
|
||||||
EmptyMessage,
|
|
||||||
|
|
||||||
/// The command was invalid (i.e. missing).
|
|
||||||
#[fail(display = "invalid command")]
|
|
||||||
InvalidCommand,
|
|
||||||
|
|
||||||
/// The mode string was malformed.
|
|
||||||
#[fail(display = "invalid mode string: {}", string)]
|
|
||||||
InvalidModeString {
|
|
||||||
/// The invalid mode string.
|
|
||||||
string: String,
|
|
||||||
/// The detailed mode parsing error.
|
|
||||||
#[cause]
|
|
||||||
cause: ModeParseError,
|
|
||||||
},
|
|
||||||
|
|
||||||
/// The subcommand used was invalid.
|
|
||||||
#[fail(display = "invalid {} subcommand: {}", cmd, sub)]
|
|
||||||
InvalidSubcommand {
|
|
||||||
/// The command whose invalid subcommand was referenced.
|
|
||||||
cmd: &'static str,
|
|
||||||
/// The invalid subcommand.
|
|
||||||
sub: String,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Errors that occur while parsing mode strings.
|
|
||||||
#[derive(Debug, Fail)]
|
|
||||||
pub enum ModeParseError {
|
|
||||||
/// Invalid modifier used in a mode string (only + and - are valid).
|
|
||||||
#[fail(display = "invalid mode modifier: {}", modifier)]
|
|
||||||
InvalidModeModifier {
|
|
||||||
/// The invalid mode modifier.
|
|
||||||
modifier: char,
|
|
||||||
},
|
|
||||||
|
|
||||||
/// Missing modifier used in a mode string.
|
|
||||||
#[fail(display = "missing mode modifier")]
|
|
||||||
MissingModeModifier,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Errors that occur with configurations.
|
/// Errors that occur with configurations.
|
||||||
#[derive(Debug, Fail)]
|
#[derive(Debug, Fail)]
|
||||||
pub enum ConfigError {
|
pub enum ConfigError {
|
||||||
|
@ -210,6 +165,17 @@ pub enum TomlError {
|
||||||
Write(#[cause] TomlWriteError),
|
Write(#[cause] TomlWriteError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<ProtocolError> for IrcError {
|
||||||
|
fn from(e: ProtocolError) -> IrcError {
|
||||||
|
match e {
|
||||||
|
ProtocolError::Io(e) => IrcError::Io(e),
|
||||||
|
ProtocolError::InvalidMessage { string, cause } => IrcError::InvalidMessage {
|
||||||
|
string, cause
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<IoError> for IrcError {
|
impl From<IoError> for IrcError {
|
||||||
fn from(e: IoError) -> IrcError {
|
fn from(e: IoError) -> IrcError {
|
||||||
IrcError::Io(e)
|
IrcError::Io(e)
|
||||||
|
|
|
@ -48,6 +48,7 @@ extern crate failure;
|
||||||
extern crate encoding;
|
extern crate encoding;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
|
pub extern crate irc_proto as proto;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
extern crate native_tls;
|
extern crate native_tls;
|
||||||
|
|
Loading…
Reference in a new issue