Module: Discordrb::Errors
- Defined in:
- lib/discordrb/errors.rb
Overview
Custom errors raised in various places
Defined Under Namespace
Classes: CloudflareError, CodeError, InvalidAuthenticationError, MessageTooLong, NoPermission, UnauthorizedWebhook
Constant Summary collapse
- UnknownError =
Used when Discord doesn’t provide a more specific code
Code(0)
- UnknownAccount =
Unknown Account
Code(10_001)
- UnknownApplication =
Unknown Application
Code(10_002)
- UnknownChannel =
Unknown Channel
Code(10_003)
- UnknownServer =
Unknown Server
Code(10_004)
- UnknownIntegration =
Unknown Integration
Code(10_005)
- UnknownInvite =
Unknown Invite
Code(10_006)
- UnknownMember =
Unknown Member
Code(10_007)
- UnknownMessage =
Unknown Message
Code(10_008)
- UnknownOverwrite =
Unknown Overwrite
Code(10_009)
- UnknownProvider =
Unknown Provider
Code(10_010)
- UnknownRole =
Unknown Role
Code(10_011)
- UnknownToken =
Unknown Token
Code(10_012)
- UnknownUser =
Unknown User
Code(10_013)
- UnknownEmoji =
Unknown Emoji
Code(10_014)
- EndpointNotForBots =
Bots cannot use this endpoint
Code(20_001)
- EndpointOnlyForBots =
Only bots can use this endpoint
Code(20_002)
- ServerLimitReached =
Maximum number of servers reached (100)
Code(30_001)
- FriendLimitReached =
Maximum number of friends reached (1000)
Code(30_002)
- PinLimitReached =
Maximum number of pins reached (50)
Code(30_003)
- RoleLimitReached =
Maximum number of guild roles reached (250)
Code(30_005)
- ReactionLimitReached =
Too many reactions
Code(30_010)
- ChannelLimitReached =
Maximum number of guild channels reached (500)
Code(30_013)
Unauthorised = Code(40_001)
- MissingAccess =
Missing Access
Code(50_001)
- InvalidAccountType =
Invalid Account Type
Code(50_002)
- InvalidActionForDM =
Cannot execute action on a DM channel
Code(50_003)
- EmbedDisabled =
Embed Disabled
Code(50_004)
- MessageAuthoredByOtherUser =
Cannot edit a message authored by another user
Code(50_005)
- MessageEmpty =
Cannot send an empty message
Code(50_006)
- NoMessagesToUser =
Cannot send messages to this user
Code(50_007)
- NoMessagesInVoiceChannel =
Cannot send messages in a voice channel
Code(50_008)
- VerificationLevelTooHigh =
Channel verification level is too high
Code(50_009)
- NoBotForApplication =
OAuth2 application does not have a bot
Code(50_010)
- ApplicationLimitReached =
OAuth2 application limit reached
Code(50_011)
- InvalidOAuthState =
Invalid OAuth State
Code(50_012)
- MissingPermissions =
Missing Permissions
Code(50_013)
- InvalidAuthToken =
Invalid authentication token
Code(50_014)
- NoteTooLong =
Note is too long
Code(50_015)
- InvalidBulkDeleteCount =
Provided too few or too many messages to delete. Must provide at least 2 and fewer than 100 messages to delete.
Code(50_016)
- CannotPinInDifferentChannel =
A message can only be pinned to the channel it was sent in
Code(50_019)
- InvalidActionForSystemMessage =
Cannot execute action on a system message
Code(50_021)
- MessageTooOld =
A message provided was too old to bulk delete
Code(50_034)
- InvalidFormBody =
Invalid Form Body
Code(50_035)
- MissingBotMember =
An invite was accepted to a guild the application’s bot is not in
Code(50_036)
- ReactionBlocked =
Reaction Blocked
Code(90_001)
Class Method Summary collapse
-
.Code(code) ⇒ Object
Create a new code error class rubocop:disable Naming/MethodName.
-
.error_class_for(code) ⇒ Class
The error class for the given code.
Class Method Details
.Code(code) ⇒ Object
Create a new code error class rubocop:disable Naming/MethodName
88 89 90 91 92 93 94 95 96 |
# File 'lib/discordrb/errors.rb', line 88 def self.Code(code) classy = Class.new(CodeError) classy.instance_variable_set(:@code, code) @code_classes ||= {} @code_classes[code] = classy classy end |
.error_class_for(code) ⇒ Class
Returns the error class for the given code.
101 102 103 |
# File 'lib/discordrb/errors.rb', line 101 def self.error_class_for(code) @code_classes[code] || UnknownError end |