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
50
51
52
53
54
55
56
57
58
pub mod vpr;
pub mod vsqx3;
pub mod vsqx4;
pub(crate) mod write_xml;
pub(crate) mod v5to4;
pub(crate) mod v4to5;
use failure::Fail;
#[derive(Fail, Debug)]
pub enum Error {
#[fail(display = "failed to serialize/deserialize JSON: {}", _0)]
SerdeJsonError(serde_json::Error),
#[fail(display = "IO Error: {}", _0)]
IoError(std::io::Error),
#[fail(display = "Zip Error: {}", _0)]
ZipError(zip::result::ZipError),
#[fail(display = "XML error: {}", _0)]
XmlError(quick_xml::Error),
#[fail(display = "XML deserialize error: {}", _0)]
XmlDeError(quick_xml::DeError),
}
impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
Self::SerdeJsonError(e)
}
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Self::IoError(e)
}
}
impl From<zip::result::ZipError> for Error {
fn from(e: zip::result::ZipError) -> Self {
Self::ZipError(e)
}
}
impl From<quick_xml::Error> for Error {
fn from(e: quick_xml::Error) -> Self {
Self::XmlError(e)
}
}
impl From<quick_xml::DeError> for Error {
fn from(e: quick_xml::DeError) -> Self {
Self::XmlDeError(e)
}
}
pub type Result<T> = std::result::Result<T, Error>;