From 60c33db56bb3754bb0d2196d5f48fee63adf7730 Mon Sep 17 00:00:00 2001 From: acdenisSK Date: Mon, 10 Jul 2017 22:11:07 +0200 Subject: Return an error if the reason the user provided exceeded the limit --- src/error.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index a9484d5..390d295 100644 --- a/src/error.rs +++ b/src/error.rs @@ -61,6 +61,10 @@ pub enum Error { Model(ModelError), /// An error occurred while parsing an integer. Num(ParseIntError), + /// Input exceeded a limit. + /// + /// *This only exists for the `GuildId::ban` and `Member::ban` functions. For their cases, it's the "reason".* + ExceededLimit, /// Some other error. This is only used for "Expected value " errors, /// when a more detailed error can not be easily provided via the /// [`Error::Decode`] variant. @@ -186,6 +190,7 @@ impl StdError for Error { fn description(&self) -> &str { match *self { Error::Decode(msg, _) | Error::Other(msg) => msg, + Error::ExceededLimit => "Input exceeded a limit", Error::Format(ref inner) => inner.description(), Error::Io(ref inner) => inner.description(), Error::Json(ref inner) => inner.description(), -- cgit v1.2.3