class VkLongpollBot::Exceptions::APIError

API error. Must have some code and description.

Attributes

error[R]

Public Class Methods

new(error) click to toggle source

Create new instance.

@param error [Hash] response hash which contains “error” key.

Calls superclass method
# File lib/vk_longpoll_bot/exceptions.rb, line 74
def initialize(error)
  @error = error["error"]
  super("#{code}: #{included_message}")
end

Public Instance Methods

code() click to toggle source

@return [Integer]

# File lib/vk_longpoll_bot/exceptions.rb, line 81
def code
  @error["error_code"]
end
description() click to toggle source

@return [String] error description from API documentation.

# File lib/vk_longpoll_bot/exceptions.rb, line 93
def description
  CODES[code]
end
included_message() click to toggle source

@return [String] attached error description.

# File lib/vk_longpoll_bot/exceptions.rb, line 87
def included_message
  @error["error_msg"]
end