diff options
| author | Zeyla Hellyer <[email protected]> | 2018-01-06 15:02:05 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-01-06 15:02:05 -0800 |
| commit | 222382ca48cb9786aaf5d0b5fc16958e482e7c5f (patch) | |
| tree | 9607694a5ec604e4ff3b73938772093e4d90cba3 /src/model/error.rs | |
| parent | Add Guild::greater_member_hierarchy (diff) | |
| download | serenity-222382ca48cb9786aaf5d0b5fc16958e482e7c5f.tar.xz serenity-222382ca48cb9786aaf5d0b5fc16958e482e7c5f.zip | |
Add some role position hierarchy checks
Diffstat (limited to 'src/model/error.rs')
| -rw-r--r-- | src/model/error.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/model/error.rs b/src/model/error.rs index 340bd18..a2b8325 100644 --- a/src/model/error.rs +++ b/src/model/error.rs @@ -86,6 +86,14 @@ pub enum Error { /// [`GuildId`]: ../model/struct.GuildId.html /// [`Cache`]: ../cache/struct.Cache.html GuildNotFound, + /// Indicates that there are hierarchy problems restricting an action. + /// + /// For example, when banning a user, if the other user has a role with an + /// equal to or higher position, then they can not be banned. + /// + /// When editing a role, if the role is higher in position than the current + /// user's highest role, then the role can not be edited. + Hierarchy, /// Indicates that you do not have the required permissions to perform an /// operation. /// @@ -126,6 +134,7 @@ impl StdError for Error { Error::DeleteMessageDaysAmount(_) => "Invalid delete message days", Error::EmbedTooLarge(_) => "Embed too large", Error::GuildNotFound => "Guild not found in the cache", + Error::Hierarchy => "Role hierarchy prevents this action", Error::InvalidPermissions(_) => "Invalid permissions", Error::InvalidUser => "The current user can not perform the action", Error::ItemMissing => "The required item is missing from the cache", |