Exception: Discordrb::Errors::CodeError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/discordrb/errors.rb

Overview

Generic class for errors denoted by API error codes

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ CodeError

Create a new error with a particular message (the code should be defined by the class instance variable)

Parameters:

  • message (String)

    the message to use



32
33
34
# File 'lib/discordrb/errors.rb', line 32

def initialize(message)
  @message = message
end

Class Attribute Details

.codeInteger (readonly)

Returns The error code represented by this error class.

Returns:

  • (Integer)

    The error code represented by this error class.



27
28
29
# File 'lib/discordrb/errors.rb', line 27

def code
  @code
end

Instance Attribute Details

#messageString (readonly)

Returns This error's represented message.

Returns:

  • (String)

    This error's represented message



42
43
44
# File 'lib/discordrb/errors.rb', line 42

def message
  @message
end

Instance Method Details

#codeInteger

Returns The error code represented by this error.

Returns:

  • (Integer)

    The error code represented by this error.



37
38
39
# File 'lib/discordrb/errors.rb', line 37

def code
  self.class.code
end