Replace assert!()s with proper errors in parsers.

This commit is contained in:
Emmanuel Gil Peyrot 2017-04-19 23:41:54 +01:00
commit fc7a0517d3
8 changed files with 23 additions and 8 deletions

View file

@ -15,7 +15,7 @@ impl MessagePayload for Body {}
pub fn parse_body(root: &Element) -> Result<Body, Error> {
if !root.is("body", JABBER_CLIENT_NS) {
return Err(Error::ParseError("Not a body element."));
return Err(Error::ParseError("This is not a body element."));
}
for _ in root.children() {
return Err(Error::ParseError("Unknown child in body element."));