@@ -4,6 +4,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#![deny(missing_docs)]
+
use std::convert::From;
use std::num;
use std::string;
@@ -14,14 +16,36 @@ use base64;
use jid;
use chrono;
+/// Contains one of the potential errors triggered while parsing an
+/// [Element](../struct.Element.html) into a specialised struct.
#[derive(Debug)]
pub enum Error {
+ /// The usual error when parsing something.
+ ///
+ /// TODO: use a structured error so the user can report it better, instead
+ /// of a freeform string.
ParseError(&'static str),
+
+ /// Generated when some base64 content fails to decode, usually due to
+ /// extra characters.
Base64Error(base64::DecodeError),
+
+ /// Generated when text which should be an integer fails to parse.
ParseIntError(num::ParseIntError),
+
+ /// Generated when text which should be a string fails to parse.
ParseStringError(string::ParseError),
+
+ /// Generated when text which should be an IP address (IPv4 or IPv6) fails
+ /// to parse.
ParseAddrError(net::AddrParseError),
+
+ /// Generated when text which should be a [JID](../../jid/struct.Jid.html)
+ /// fails to parse.
JidParseError(jid::JidParseError),
+
+ /// Generated when text which should be a
+ /// [DateTime](../date/struct.DateTime.html) fails to parse.
ChronoParseError(chrono::ParseError),
}