error.rs

 1//! Provides an error type for this crate.
 2
 3use std::convert::From;
 4
 5error_chain! {
 6    foreign_links {
 7        XmlError(::quick_xml::errors::Error)
 8            /// An error from quick_xml.
 9        ;
10        Utf8Error(::std::str::Utf8Error)
11            /// An UTF-8 conversion error.
12        ;
13        IoError(::std::io::Error)
14            /// An I/O error, from std::io.
15        ;
16    }
17
18    errors {
19        /// An error which is returned when the end of the document was reached prematurely.
20        EndOfDocument {
21            description("the end of the document has been reached prematurely")
22            display("the end of the document has been reached prematurely")
23        }
24        /// An error which is returned when an element is closed when it shouldn't be
25        InvalidElementClosed {
26            description("The XML is invalid, an element was wrongly closed")
27            display("the XML is invalid, an element was wrongly closed")
28        }
29        /// An error which is returned when an elemet's name contains more than one colon
30        InvalidElement {
31            description("The XML element is invalid")
32            display("the XML element is invalid")
33        }
34    }
35}