Exception: DiscordRDA::RestClient::APIError
- Inherits:
-
StandardError
- Object
- StandardError
- DiscordRDA::RestClient::APIError
- Defined in:
- lib/discord_rda/connection/rest_client.rb
Overview
REST API Errors
Direct Known Subclasses
BadRequestError, ForbiddenError, NotFoundError, RateLimitedError, ServerError, UnauthorizedError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, data) ⇒ APIError
constructor
A new instance of APIError.
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
#code ⇒ Object (readonly)
Returns the value of attribute code.
291 292 293 |
# File 'lib/discord_rda/connection/rest_client.rb', line 291 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
291 292 293 |
# File 'lib/discord_rda/connection/rest_client.rb', line 291 def data @data end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
291 292 293 |
# File 'lib/discord_rda/connection/rest_client.rb', line 291 def @message end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
291 292 293 |
# File 'lib/discord_rda/connection/rest_client.rb', line 291 def status @status end |