From 3477117deaa74722aeeca3aa097ad499a10e42f4 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 8 Aug 2018 18:40:01 +0200 Subject: [PATCH] error: Document this module. --- src/error.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/error.rs b/src/error.rs index 09e6b9b..05d1ff7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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), }