Skip to main content

ews/
lib.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5use std::io;
6
7use thiserror::Error;
8
9#[cfg(test)]
10mod test_utils;
11
12mod types;
13
14pub use types::*;
15
16#[cfg(feature = "interop")]
17pub mod interop;
18
19#[derive(Debug, Error)]
20pub enum Error {
21    #[error("failed to serialize structure as XML: {0}")]
22    Serialize(#[from] xml_struct::Error),
23
24    #[error("failed to deserialize structure from XML: {0}")]
25    Deserialize(#[from] serde_path_to_error::Error<quick_xml::DeError>),
26
27    #[error("I/O error: {0}")]
28    Io(#[from] io::Error),
29
30    #[error("invalid XML document: {0}")]
31    InvalidXml(#[from] quick_xml::Error),
32
33    #[error("unexpected response body")]
34    UnexpectedResponse(Vec<u8>),
35
36    // The `Fault` is boxed so as to keep the in-memory size of the enum itself
37    // relatively low.
38    #[error("a fault occurred in the request")]
39    RequestFault(Box<soap::Fault>),
40
41    #[error("unknown server version: {0}")]
42    UnknownServerVersion(String),
43}