aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-07-10 22:11:07 +0200
committeracdenisSK <[email protected]>2017-07-10 22:11:07 +0200
commit60c33db56bb3754bb0d2196d5f48fee63adf7730 (patch)
treed0a8dda83c9b74891866c95cc57dc65f5416d8ab /src/error.rs
parentUse a trait way of overloading the `ban` function instead of an enum (diff)
downloadserenity-60c33db56bb3754bb0d2196d5f48fee63adf7730.tar.xz
serenity-60c33db56bb3754bb0d2196d5f48fee63adf7730.zip
Return an error if the reason the user provided exceeded the limit
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs5
1 files changed, 5 insertions, 0 deletions
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 <TYPE>" 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(),