2017-04-18 19:44:36 +00:00
|
|
|
use std::convert::From;
|
|
|
|
use std::io;
|
2017-04-22 16:39:00 +00:00
|
|
|
use std::num;
|
2017-04-18 19:44:36 +00:00
|
|
|
|
2017-04-21 01:46:41 +00:00
|
|
|
use base64;
|
2017-04-18 19:44:36 +00:00
|
|
|
use minidom;
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum Error {
|
2017-04-21 01:46:41 +00:00
|
|
|
ParseError(&'static str),
|
2017-04-18 19:44:36 +00:00
|
|
|
IoError(io::Error),
|
|
|
|
XMLError(minidom::Error),
|
2017-04-27 17:33:02 +00:00
|
|
|
Base64Error(base64::DecodeError),
|
2017-04-22 16:39:00 +00:00
|
|
|
ParseIntError(num::ParseIntError),
|
2017-04-18 19:44:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl From<io::Error> for Error {
|
|
|
|
fn from(err: io::Error) -> Error {
|
|
|
|
Error::IoError(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<minidom::Error> for Error {
|
|
|
|
fn from(err: minidom::Error) -> Error {
|
|
|
|
Error::XMLError(err)
|
|
|
|
}
|
|
|
|
}
|
2017-04-21 01:46:41 +00:00
|
|
|
|
2017-04-27 17:33:02 +00:00
|
|
|
impl From<base64::DecodeError> for Error {
|
|
|
|
fn from(err: base64::DecodeError) -> Error {
|
2017-04-21 01:46:41 +00:00
|
|
|
Error::Base64Error(err)
|
|
|
|
}
|
|
|
|
}
|
2017-04-22 16:39:00 +00:00
|
|
|
|
|
|
|
impl From<num::ParseIntError> for Error {
|
|
|
|
fn from(err: num::ParseIntError) -> Error {
|
|
|
|
Error::ParseIntError(err)
|
|
|
|
}
|
|
|
|
}
|