From 79804e2b01d4cf3861bd6ba7504e71c4fbe4f467 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 7 Sep 2019 16:15:32 +0200 Subject: [PATCH] error: Use better error messages. --- src/util/error.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/error.rs b/src/util/error.rs index f2378a19b4d99314abc43445a86335a960d10085..408c649bf4c46101dc054ab593cd32de7e46d1b0 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -48,14 +48,14 @@ pub enum Error { impl fmt::Display for Error { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - match *self { - Error::ParseError(s) => write!(fmt, "{}", s), - Error::Base64Error(ref e) => write!(fmt, "{}", e), - Error::ParseIntError(ref e) => write!(fmt, "{}", e), - Error::ParseStringError(ref e) => write!(fmt, "{}", e), - Error::ParseAddrError(ref e) => write!(fmt, "{}", e), - Error::JidParseError(_) => write!(fmt, "JID parse error"), - Error::ChronoParseError(ref e) => write!(fmt, "{}", e), + match self { + Error::ParseError(s) => write!(fmt, "parse error: {}", s), + Error::Base64Error(e) => write!(fmt, "base64 error: {}", e), + Error::ParseIntError(e) => write!(fmt, "integer parsing error: {}", e), + Error::ParseStringError(e) => write!(fmt, "string parsing error: {}", e), + Error::ParseAddrError(e) => write!(fmt, "IP address parsing error: {}", e), + Error::JidParseError(e) => write!(fmt, "JID parsing error: {}", e), + Error::ChronoParseError(e) => write!(fmt, "time parsing error: {}", e), } } }