error: Document this module.
This commit is contained in:
parent
bdae556787
commit
3477117dea
1 changed files with 24 additions and 0 deletions
24
src/error.rs
24
src/error.rs
|
@ -4,6 +4,8 @@
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// 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/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
use std::num;
|
use std::num;
|
||||||
use std::string;
|
use std::string;
|
||||||
|
@ -14,14 +16,36 @@ use base64;
|
||||||
use jid;
|
use jid;
|
||||||
use chrono;
|
use chrono;
|
||||||
|
|
||||||
|
/// Contains one of the potential errors triggered while parsing an
|
||||||
|
/// [Element](../struct.Element.html) into a specialised struct.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
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),
|
ParseError(&'static str),
|
||||||
|
|
||||||
|
/// Generated when some base64 content fails to decode, usually due to
|
||||||
|
/// extra characters.
|
||||||
Base64Error(base64::DecodeError),
|
Base64Error(base64::DecodeError),
|
||||||
|
|
||||||
|
/// Generated when text which should be an integer fails to parse.
|
||||||
ParseIntError(num::ParseIntError),
|
ParseIntError(num::ParseIntError),
|
||||||
|
|
||||||
|
/// Generated when text which should be a string fails to parse.
|
||||||
ParseStringError(string::ParseError),
|
ParseStringError(string::ParseError),
|
||||||
|
|
||||||
|
/// Generated when text which should be an IP address (IPv4 or IPv6) fails
|
||||||
|
/// to parse.
|
||||||
ParseAddrError(net::AddrParseError),
|
ParseAddrError(net::AddrParseError),
|
||||||
|
|
||||||
|
/// Generated when text which should be a [JID](../../jid/struct.Jid.html)
|
||||||
|
/// fails to parse.
|
||||||
JidParseError(jid::JidParseError),
|
JidParseError(jid::JidParseError),
|
||||||
|
|
||||||
|
/// Generated when text which should be a
|
||||||
|
/// [DateTime](../date/struct.DateTime.html) fails to parse.
|
||||||
ChronoParseError(chrono::ParseError),
|
ChronoParseError(chrono::ParseError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue