diff options
Diffstat (limited to 'src/errors.rs')
-rw-r--r-- | src/errors.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs new file mode 100644 index 0000000..2704bd9 --- /dev/null +++ b/src/errors.rs @@ -0,0 +1,28 @@ +use quick_xml; + +error_chain! { + foreign_links { + Io(::std::io::Error); + XML(quick_xml::errors::Error); + NumParse(::std::num::ParseIntError); + Utf8(::std::str::Utf8Error); + } + errors { + FromXml(pos: usize, tag: String) { + description("invalid input while processing tag") + display("error at pos {}: invalid <{}>", pos, tag) + } + ElementText(pos: usize) { + description("found something other than text") + display("error at pos {}: not text", pos) + } + ClosingTag(pos: usize) { + description("found something other than a closing tag") + display("error at pos {}: expected a closing tag", pos) + } + EOF { + description("premature EOF") + display("expected more things") + } + } +} |