diff options
| author | acdenisSK <[email protected]> | 2017-10-24 18:10:10 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-10-24 18:10:10 +0200 |
| commit | ef60c3cd5b93d61ff8200f5f6871b449bf7dccb5 (patch) | |
| tree | ff9ec9e09dc363c05c6b582380a120ca47290a9f /src/framework/standard/mod.rs | |
| parent | Remove `on_` prefix to EventHandler tymethods (diff) | |
| parent | Fall back to `str::parse` if `parse_username` fails (diff) | |
| download | serenity-ef60c3cd5b93d61ff8200f5f6871b449bf7dccb5.tar.xz serenity-ef60c3cd5b93d61ff8200f5f6871b449bf7dccb5.zip | |
Merge v0.4.2
Diffstat (limited to 'src/framework/standard/mod.rs')
| -rw-r--r-- | src/framework/standard/mod.rs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs index 6504c6a..36570af 100644 --- a/src/framework/standard/mod.rs +++ b/src/framework/standard/mod.rs @@ -14,7 +14,7 @@ pub use self::command::CommandOrAlias; pub use self::configuration::Configuration; pub use self::create_command::CreateCommand; pub use self::create_group::CreateGroup; -pub use self::args::{Args, Error as ArgError}; +pub use self::args::{Args, Iter, FromStrZc, Error as ArgError}; use self::command::{AfterHook, BeforeHook}; use std::collections::HashMap; @@ -138,6 +138,31 @@ pub enum DispatchError { WebhookAuthor, } +use std::fmt; + +impl fmt::Debug for DispatchError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use self::DispatchError::*; + + match *self { + CheckFailed(..) => write!(f, "DispatchError::CheckFailed"), + CommandDisabled(ref s) => f.debug_tuple("DispatchError::CommandDisabled").field(&s).finish(), + BlockedUser => write!(f, "DispatchError::BlockedUser"), + BlockedGuild => write!(f, "DispatchError::BlockedGuild"), + LackOfPermissions(ref perms) => f.debug_tuple("DispatchError::LackOfPermissions").field(&perms).finish(), + RateLimited(ref num) => f.debug_tuple("DispatchError::RateLimited").field(&num).finish(), + OnlyForDM => write!(f, "DispatchError::OnlyForDM"), + OnlyForOwners => write!(f, "DispatchError::OnlyForOwners"), + OnlyForGuilds => write!(f, "DispatchError::OnlyForGuilds"), + LackingRole => write!(f, "DispatchError::LackingRole"), + NotEnoughArguments { ref min, ref given } => f.debug_struct("DispatchError::NotEnoughArguments").field("min", &min).field("given", &given).finish(), + TooManyArguments { ref max, ref given } => f.debug_struct("DispatchError::TooManyArguments").field("max", &max).field("given", &given).finish(), + IgnoredBot => write!(f, "DispatchError::IgnoredBot"), + WebhookAuthor => write!(f, "DispatchError::WebhookAuthor"), + } + } +} + type DispatchErrorHook = Fn(Context, Message, DispatchError) + Send + Sync + 'static; /// A utility for easily managing dispatches to commands. |