Exception: DiscordRDA::RestClient::APIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/discord_rda/connection/rest_client.rb

Overview

REST API Errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, data) ⇒ APIError

Returns a new instance of APIError.



293
294
295
296
297
298
299
# File 'lib/discord_rda/connection/rest_client.rb', line 293

def initialize(status, data)
  @status = status
  @data = data || {}
  @code = @data['code']
  @message = @data['message'] || 'Unknown error'
  super("API Error #{status}: #{@message}")
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



291
292
293
# File 'lib/discord_rda/connection/rest_client.rb', line 291

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



291
292
293
# File 'lib/discord_rda/connection/rest_client.rb', line 291

def data
  @data
end

#messageObject (readonly)

Returns the value of attribute message.



291
292
293
# File 'lib/discord_rda/connection/rest_client.rb', line 291

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status.



291
292
293
# File 'lib/discord_rda/connection/rest_client.rb', line 291

def status
  @status
end