module Discordrb::Errors

Custom errors raised in various places

Constants

ApplicationLimitReached

OAuth2 application limit reached

CannotPinInDifferentChannel

A message can only be pinned to the channel it was sent in

ChannelLimitReached

Maximum number of guild channels reached (500)

EmbedDisabled

Embed Disabled

EndpointNotForBots

Bots cannot use this endpoint

EndpointOnlyForBots

Only bots can use this endpoint

FriendLimitReached

Maximum number of friends reached (1000)

InvalidAccountType

Invalid Account Type

InvalidActionForDM

Cannot execute action on a DM channel

InvalidActionForSystemMessage

Cannot execute action on a system message

InvalidAuthToken

Invalid authentication token

InvalidBulkDeleteCount

Provided too few or too many messages to delete. Must provide at least 2 and fewer than 100 messages to delete.

InvalidFormBody

Invalid Form Body

InvalidOAuthState

Invalid OAuth State

MessageAuthoredByOtherUser

Cannot edit a message authored by another user

MessageEmpty

Cannot send an empty message

MessageTooOld

A message provided was too old to bulk delete

MissingAccess

Missing Access

MissingBotMember

An invite was accepted to a guild the application's bot is not in

MissingPermissions

Missing Permissions

NoBotForApplication

OAuth2 application does not have a bot

NoMessagesInVoiceChannel

Cannot send messages in a voice channel

NoMessagesToUser

Cannot send messages to this user

NoteTooLong

Note is too long

PinLimitReached

Maximum number of pins reached (50)

ReactionBlocked

Reaction Blocked

ReactionLimitReached

Too many reactions

RoleLimitReached

Maximum number of guild roles reached (250)

ServerLimitReached

Maximum number of servers reached (100)

Unauthorized

Unauthorized

UnknownAccount

Unknown Account

UnknownApplication

Unknown Application

UnknownChannel

Unknown Channel

UnknownEmoji

Unknown Emoji

UnknownError

Used when Discord doesn't provide a more specific code

UnknownIntegration

Unknown Integration

UnknownInvite

Unknown Invite

UnknownMember

Unknown Member

UnknownMessage

Unknown Message

UnknownOverwrite

Unknown Overwrite

UnknownProvider

Unknown Provider

UnknownRole

Unknown Role

UnknownServer

Unknown Server

UnknownToken

Unknown Token

UnknownUser

Unknown User

VerificationLevelTooHigh

Channel verification level is too high

Public Class Methods

Code(code) click to toggle source

Create a new code error class rubocop:disable Naming/MethodName

# File lib/discordrb/errors.rb, line 47
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) click to toggle source

@param code [Integer] The code to check @return [Class] the error class for the given code

# File lib/discordrb/errors.rb, line 60
def self.error_class_for(code)
  @code_classes[code]
end