Module: Rubycord::Errors
- Defined in:
- lib/rubycord/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)
- UnknownPermissionOverwrite =
Unknown Permission 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)
- UnknownWebhook =
Unknown Webhook
-
Code(10_015)
- UnknownWebhookService =
Unknown Webhook Service
-
Code(10_016)
- UnknownSession =
Unknown Session
-
Code(10_020)
- UnknownBan =
Unknown Ban
-
Code(10_026)
- UnknownSKU =
Unknown SKU
-
Code(10_027)
- UnknownStoreListing =
Unknown Store Listing
-
Code(10_028)
- UnknownEntitlement =
Unknown Entitlement
-
Code(10_029)
- UnknownBuild =
Unknown Build
-
Code(10_030)
- UnknownLobby =
Unknown Lobby
-
Code(10_031)
- UnknownBranch =
Unknown Branch
-
Code(10_032)
- UnknownStoreDirectoryLayout =
Unknown Store directory layout
-
Code(10_033)
- UnknownRedistribuable =
Unknown Redistribuable
-
Code(10_036)
- UnknownGiftCode =
Unknown Gift code
-
Code(10_038)
- UnknownStream =
Unknown Stream
-
Code(10_049)
- UnknownPremiumServerSubscribeCooldown =
Unknown Premium server subscribe cooldown
-
Code(10_050)
- UnknownServerTemplate =
Unknown Server Template
-
Code(10_057)
- UnknownDiscoverableServerCategory =
Unknown Discoverable server category
-
Code(10_059)
- UnknownSticker =
Unknown Sticker
-
Code(10_060)
- UnknownInteraction =
Unknown Interaction
-
Code(10_062)
- UnknownApplicationCommand =
Unknown Application command
-
Code(10_063)
- UnknownVoiceState =
Unknown Voice state
-
Code(10_065)
- UnknownApplicationCommandPermissions =
Unknown Application command permissions
-
Code(10_066)
- UnknownStageInstance =
Unknown Stage Instance
-
Code(10_067)
- UnknownServerMemberVerificationForm =
Unknown Server member verification form
-
Code(10_068)
- UnknownServerWelcomeScreen =
Unknown Server welcome screen
-
Code(10_069)
- UnknownServerScheduledEvent =
Unknown Server scheduled event
-
Code(10_070)
- UnknownServerScheduledEventUser =
Unknown Server scheduled event user
-
Code(10_071)
- UnknownTag =
Unknown Tag
-
Code(10_087)
- EndpointNotForBots =
Bots cannot use this endpoint
-
Code(20_001)
- EndpointOnlyForBots =
Only bots can use this endpoint
-
Code(20_002)
- ExplicitContentCannotBeSent =
Explicit content cannot be sent to the desired recipient(s)
-
Code(20_009)
- ActionNotAuthorizedOnApplication =
You are not authorized to perform this action on this application
-
Code(20_012)
- ActionNotPerformedDueToSlowmode =
This action cannot be performed due to slowmode rate limit
-
Code(20_016)
- OnlyOwnerCanPerformAction =
Only the owner of this account can perform this action
-
Code(20_018)
- EditMessageAnnouncementRateLimited =
This message cannot be edited due to announcement rate limits
-
Code(20_022)
- UnderMinimumAge =
Under minimum age
-
Code(20_024)
- ChannelHitWriteRateLimit =
The channel you are writing has hit the write rate limit
-
Code(20_028)
- ServerHitWriteRateLimit =
The write action you are performing on the server has hit the write rate limit
-
Code(20_029)
- ContainWordsNotAllowed =
Your Stage topic, server name, server description, or channel names contain words that are not allowed
-
Code(20_031)
- GuildPremiumSubscriptionLevelTooLow =
Guild premium subscription level too low
-
Code(20_035)
- 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)
- RecipientLimitReached =
Maximum number of recipients reached (10)
-
Code(30_004)
- RoleLimitReached =
Maximum number of guild roles reached (250)
-
Code(30_005)
- WebhookLimitReached =
Maximum number of webhooks reached (15)
-
Code(30_007)
- EmojiLimitReached =
Maximum number of emojis reached
-
Code(30_008)
- ReactionLimitReached =
Maximum number of reactions reached (20)
-
Code(30_010)
- GroupChannelLimitReached =
Maximum number of group DMs reached (10)
-
Code(30_011)
- ChannelLimitReached =
Maximum number of guild channels reached (500)
-
Code(30_013)
- MessageAttachmentLimitReached =
Maximum number of attachments in a message reached (10)
-
Code(30_015)
- InviteLimitReached =
Maximum number of invites reached (1000)
-
Code(30_016)
- AnimatedEmojiLimitReached =
Maximum number of animated emojis reached
-
Code(30_018)
- ServerMemberLimitReached =
Maximum number of server members reached
-
Code(30_019)
- ServerCategoryLimitReached =
Maximum number of server categories has been reached (5)
-
Code(30_030)
- ServerAlreadyHasTemplate =
Guild already has a template
-
Code(30_031)
- ApplicationCommandLimitReached =
Maximum number of application commands reached
-
Code(30_032)
- ThreadParticipantLimitReached =
Maximum number of thread participants has been reached (1000)
-
Code(30_033)
- ApplicationCommandCreateLimitReached =
Maximum number of daily application command creates has been reached (200)
-
Code(30_034)
- BanNonServerMemberLimitReached =
Maximum number of bans for non-guild members have been exceeded
-
Code(30_035)
- BanFetchLimitReached =
Maximum number of bans fetches has been reached
-
Code(30_037)
- UncompletedServerScheduledEventLimitReached =
Maximum number of uncompleted guild scheduled events reached (100)
-
Code(30_038)
- StickerLimitReached =
Maximum number of stickers reached
-
Code(30_039)
- PruneRequestLimitReached =
Maximum number of prune requests has been reached. Try again later
-
Code(30_040)
- ServerWidgetUpdateLimitReached =
Maximum number of guild widget settings updates has been reached. Try again later
-
Code(30_042)
- MessageEditOlderOneHourLimitReached =
Maximum number of edits to messages older than 1 hour reached. Try again later
-
Code(30_046)
- ForumPinnedThreadLimitReached =
Maximum number of pinned threads in a forum channel has been reached
-
Code(30_047)
- ForumTagLimitReached =
Maximum number of tags in a forum channel has been reached
-
Code(30_048)
- BitrateTooHigh =
Bitrate is too high for channel of this type
-
Code(30_052)
- PremiumEmojiLimitReached =
Maximum number of premium emojis reached (25)
-
Code(30_056)
- ServerWebhookLimitReached =
Maximum number of webhooks per guild reached (1000)
-
Code(30_058)
- ChannelPermissionOverwriteLimitReached =
Maximum number of channel permission overwrites reached (1000)
-
Code(30_060)
- ServerChannelTooLarge =
The channels for this guild are too large
-
Code(30_061)
-
Unauthorised = Code(40_001)
- NeedVerifiedAccount =
You need to verify your account in order to perform this action
-
Code(40_002)
- DirectMessageOpenTooFast =
You are opening direct messages too fast
-
Code(40_003)
- SendMessageTemporarilyDisabled =
Send messages has been temporarily disabled
-
Code(40_004)
- RequestEntityTooLarge =
Request entity too large. Try sending something smaller in size
-
Code(40_005)
- ServerFeatureTemporarilyDisabled =
This feature has been temporarily disabled server-side
-
Code(40_006)
- UserBannedFromServer =
The user is banned from this guild
-
Code(40_007)
- ConnectionRevoked =
Connection has been revoked
-
Code(40_012)
- UserNotVoiceConnected =
Target user is not connected to voice
-
Code(40_032)
- MessageAlreadyCrossposted =
This message has already been crossposted
-
Code(40_033)
- ApplicationCommandAlreadyExists =
An application command with that name already exists
-
Code(40_041)
- ApplicationInteractionSendFailed =
Application interaction failed to send
-
Code(40_043)
- ForumMessageCannotSend =
Cannot send a message in a forum channel
-
Code(40_058)
- InteractionAlreadyAcknowledged =
Interaction has already been acknowledged
-
Code(40_060)
- TagNameMustBeUnique =
Tag names must be unique
-
Code(40_061)
- ServiceResourceRateLimited =
Service resource is being rate limited
-
Code(40_062)
- NoTagAvailableForNonModerator =
There are no tags available that can be set by non-moderators
-
Code(40_066)
- ForumPostCreateTagRequired =
A tag is required to create a forum post in this channel
-
Code(40_067)
- ResourceEntitlementAlreadyGranted =
An entitlement has already been granted for this resource
-
Code(40_074)
- RequestBlockedByCloudflare =
Cloudflare is blocking your request. This can often be resolved by setting a proper User Agent
-
Code(40_333)
- MissingAccess =
Missing Access
-
Code(50_001)
- InvalidAccountType =
Invalid Account Type
-
Code(50_002)
- InvalidActionForDM =
Cannot execute action on a DM channel
-
Code(50_003)
- ServerWidgetDisabled =
Server widget 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)
- LackPermissions =
You lack permissions to perform that action
-
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)
- InvalidMFALevel =
Invalid MFA Level
-
Code(50_017)
- CannotPinInDifferentChannel =
A message can only be pinned to the channel it was sent in
-
Code(50_019)
- InvalidInviteCode =
Invite code was either invalid or taken
-
Code(50_020)
- InvalidActionForSystemMessage =
Cannot execute action on a system message
-
Code(50_021)
- CannotExecuteOnChannelType =
Cannot execute action on this channel type
-
Code(50_024)
- InvalidOAuthAccessToken =
Invalid OAuth2 access token provided
-
Code(50_025)
- MissingOAuthScope =
Missing required OAuth2 scope
-
Code(50_026)
- InvalidWebhookToken =
Invalid webhook token provided
-
Code(50_027)
- InvalidRole =
Invalid role
-
Code(50_028)
- InvalidRecipient =
Invalid Recipient(s)
-
Code(50_033)
- MessageTooOld =
A message provided was too old to bulk delete
-
Code(50_034)
- InvalidFormBody =
Invalid form body (returned for both application/json and multipart/form-data bodies), or invalid Content-Type provided
-
Code(50_035)
- MissingBotMember =
An invite was accepted to a guild the application's bot is not in
-
Code(50_036)
- InvalidActivityAction =
Invalid Activity Action
-
Code(50_039)
- InvalidAPIVersion =
Invalid API version provided
-
Code(50_041)
- FileSizeUploadLimitReached =
File uploaded exceeds the maximum size
-
Code(50_045)
- InvalidFileUpload =
Invalid file uploaded
-
Code(50_046)
- CannotSelfRedeemGift =
Cannot self-redeem this gift
-
Code(50_054)
- InvalidServer =
Invalid Server
-
Code(50_055)
- InvalidSKU =
Invalid SKU
-
Code(50_057)
- InvalidRequestOrigin =
Invalid Request origin
-
Code(50_067)
- InvalidMessageType =
Invalid Message type
-
Code(50_068)
- PaymentSourceRequired =
Payment source required to redeem gift
-
Code(50_070)
- CannotModifySystemWebhook =
Cannot modify a system webhook
-
Code(50_073)
- CannotDeleteCommunityServerChannelRequired =
Cannot delete a channel required for Community guilds
-
Code(50_074)
- CannotEditMessageSticker =
Cannot edit stickers within a message
-
Code(50_080)
- InvalidStickerSent =
Invalid sticker sent
-
Code(50_081)
- OperationOnArchivedThread =
Tried to perform an operation on an archived thread, such as editing a message or adding a user to the thread
-
Code(50_083)
- InvalidThreadNotificationSettings =
Invalid thread notification settings
-
Code(50_084)
- BeforeValueEarlierThanThread =
before value is earlier than the thread creation date
-
Code(50_085)
- CommunityServerChannelMustBeTextChannel =
Community server channels must be text channels
-
Code(50_086)
- EntityTypeEventMismatch =
The entity type of the event is different from the entity you are trying to start the event for
-
Code(50_091)
- ServerNotAvailableInYourLocation =
This server is not available in your location
-
Code(50_095)
- ServerNeedsMonetizationEnabled =
This server needs monetization enabled in order to perform this action
-
Code(50_097)
- ServerNeedsMoreBoosts =
This server needs more boosts to perform this action
-
Code(50_101)
- RequestBodyInvalidJSON =
The request body contains invalid JSON
-
Code(50_109)
- OwnerCannotBePendingMember =
Owner cannot be pending member
-
Code(50_131)
- OwnershipCannotTransferedToBot =
Ownership cannot be transferred to a bot user
-
Code(50_132)
- FailedResizeBelowAssetLimit =
Failed to resize asset below the maximum size: 262144
-
Code(50_138)
- EmojiCannotMixSubscriptionTypeRole =
Cannot mix subscription and non subscription roles for an emoji
-
Code(50_144)
- CannotConvertBetweenPremiumAndNormalEmoji =
Cannot convert between premium emoji and normal emoji
-
Code(50_145)
- UploadedFileNotFound =
Uploaded file not found
-
Code(50_146)
- VoiceMessageAdditionalContentNotSupported =
Voice messages do not support additional content
-
Code(50_159)
- VoiceMessageMustHaveSingleAudio =
Voice messages must have a single audio attachment
-
Code(50_160)
- VoiceMessageMustSupportMetadata =
Voice messages must have supporting metadata
-
Code(50_161)
- VoiceMessageCannotBeEdited =
Voice messages cannot be edited
-
Code(50_162)
- ServerSubscriptionIntegrationCannotBeDeleted =
Cannot delete guild subscription integration
-
Code(50_163)
- CannotSendVoiceMessage =
You cannot send voice messages in this channel
-
Code(50_173)
- UserAccountMustBeVerified =
The user account must first be verified
-
Code(50_178)
- NeedPermissionToSendSticker =
You do not have permission to send this sticker
-
Code(50_600)
- TwoFactorRequired =
Two factor is required for this operation
-
Code(60_003)
- UserDiscordTagNotExist =
No users with DiscordTag exist
-
Code(80_004)
- ReactionBlocked =
Reaction Blocked
-
Code(90_001)
- UserCannotBurstReactions =
User cannot use burst reactions
-
Code(90_002)
- ApplicationNotYetAvailable =
Application not yet available. Try again later
-
Code(110_001)
- APIResourceOverloaded =
API resource is currently overloaded. Try again a little later
-
Code(130_000)
- StageAlreadyOpen =
The Stage is already open
-
Code(150_006)
- CannotReplyWithoutReadMessageHistory =
Cannot reply without permission to read message history
-
Code(160_002)
- MessageThreadAlreadyCreated =
A thread has already been created for this message
-
Code(160_004)
- ThreadLocked =
Thread is locked
-
Code(160_005)
- ActiveThreadLimitReached =
Maximum number of active threads reached
-
Code(160_006)
- ActiveAnnouncementThreadLimitReached =
Maximum number of active announcement threads reached
-
Code(160_007)
- LottieInvalidJSON =
Invalid JSON for uploaded Lottie file
-
Code(170_001)
- LottieCannotContainRasterizedImages =
Uploaded Lotties cannot contain rasterized images such as PNG or JPEG
-
Code(170_002)
- StickerFramerateLimitReached =
Sticker maximum framerate exceeded
-
Code(170_003)
- StickerFrameLimitReached =
Sticker frame count exceeds maximum of 1000 frames
-
Code(170_004)
- LottieDimensionLimitReached =
Lottie animation maximum dimensions exceeded
-
Code(170_005)
- StickerFramerateInvalid =
Sticker frame rate is either too small or too large
-
Code(170_006)
- StickerDurationLimitReached =
Sticker animation duration exceeds maximum of 5 seconds
-
Code(170_007)
- CannotUpdateFinishedEvent =
Cannot update a finished event
-
Code(180_000)
- StageCreateFailed =
Failed to create stage needed for stage event
-
Code(180_002)
- MessageBlockedByAutoMod =
Message was blocked by automatic moderation
-
Code(200_000)
- TitleBlockedByAutoMod =
Title was blocked by automatic moderation
-
Code(200_001)
- ForumWebhookPostMissingArgument =
Webhooks posted to forum channels must have a thread_name or thread_id
-
Code(220_001)
- ForumWebhookPostTooMuchArgument =
Webhooks posted to forum channels cannot have both a thread_name and thread_id
-
Code(220_002)
- OnlyForumWebhookCanCreateThread =
Webhooks can only create threads in forum channels
-
Code(220_003)
- ForumWebhookCannotUseService =
Webhook services cannot be used in forum channels
-
Code(220_004)
- MessageBlockedByHarmfulLinkFilter =
Message blocked by harmful links filter
-
Code(240_000)
- CannotEnableOnboarding =
Cannot enable onboarding, requirements are not met
-
Code(350_000)
- CannotUpdateOnboarding =
Cannot update onboarding while below requirements
-
Code(350_001)
- BanUserFailed =
Failed to ban users
-
Code(500_000)
- PollVotingBlocked =
Poll voting blocked
-
Code(520_000)
- PollExpired =
Poll expired
-
Code(520_001)
- PollInvalidTypeChannel =
Invalid channel type for poll creation
-
Code(520_002)
- PollMessageCannotBeEdited =
Cannot edit a poll message
-
Code(520_003)
- PollCannotUseEmojiIncluded =
Cannot use an emoji included with the poll
-
Code(520_004)
- CannotExpireNonPollMessage =
Cannot expire a non-poll message
-
Code(520_006)
Class Method Summary collapse
-
.Code(code) ⇒ Object
Create a new code error class.
-
.error_class_for(code) ⇒ Class
The error class for the given code.
Class Method Details
.Code(code) ⇒ Object
Create a new code error class
85 86 87 88 89 90 91 92 93 |
# File 'lib/rubycord/errors.rb', line 85 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.
97 98 99 |
# File 'lib/rubycord/errors.rb', line 97 def self.error_class_for(code) @code_classes[code] || UnknownError end |