2017-02-18 21:16:20 +00:00
|
|
|
use std::io;
|
|
|
|
|
|
|
|
use std::net::TcpStream;
|
|
|
|
|
|
|
|
use openssl::ssl::HandshakeError;
|
|
|
|
use openssl::error::ErrorStack;
|
|
|
|
|
|
|
|
use xml::reader::Error as XmlError;
|
2017-02-19 01:04:09 +00:00
|
|
|
use xml::writer::Error as EmitterError;
|
2017-02-18 21:16:20 +00:00
|
|
|
|
2017-02-21 16:14:54 +00:00
|
|
|
use minidom::Error as MinidomError;
|
2017-02-19 20:00:59 +00:00
|
|
|
|
2017-02-18 21:16:20 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum Error {
|
|
|
|
XmlError(XmlError),
|
2017-02-19 01:04:09 +00:00
|
|
|
EmitterError(EmitterError),
|
2017-02-18 21:16:20 +00:00
|
|
|
IoError(io::Error),
|
|
|
|
HandshakeError(HandshakeError<TcpStream>),
|
|
|
|
OpenSslErrorStack(ErrorStack),
|
2017-02-19 20:00:59 +00:00
|
|
|
MinidomError(MinidomError),
|
2017-02-18 21:16:20 +00:00
|
|
|
StreamError,
|
2017-02-19 17:08:35 +00:00
|
|
|
EndOfDocument,
|
2017-02-18 21:16:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl From<XmlError> for Error {
|
|
|
|
fn from(err: XmlError) -> Error {
|
|
|
|
Error::XmlError(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-19 01:04:09 +00:00
|
|
|
impl From<EmitterError> for Error {
|
|
|
|
fn from(err: EmitterError) -> Error {
|
|
|
|
Error::EmitterError(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-18 21:16:20 +00:00
|
|
|
impl From<io::Error> for Error {
|
|
|
|
fn from(err: io::Error) -> Error {
|
|
|
|
Error::IoError(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<HandshakeError<TcpStream>> for Error {
|
|
|
|
fn from(err: HandshakeError<TcpStream>) -> Error {
|
|
|
|
Error::HandshakeError(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<ErrorStack> for Error {
|
|
|
|
fn from(err: ErrorStack) -> Error {
|
|
|
|
Error::OpenSslErrorStack(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-19 20:00:59 +00:00
|
|
|
impl From<MinidomError> for Error {
|
|
|
|
fn from(err: MinidomError) -> Error {
|
|
|
|
Error::MinidomError(err)
|
|
|
|
}
|
|
|
|
}
|