Exception: Twitch::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/twitch/api_error.rb

Overview

An error returned by the API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, body) ⇒ ApiError

Returns a new instance of ApiError.



9
10
11
12
13
14
15
# File 'lib/twitch/api_error.rb', line 9

def initialize(status_code, body)
  @status_code = status_code
  @body = body

  msg = "The server returned error #{status_code}"
  super(msg)
end

Instance Attribute Details

#bodyObject (readonly)

Body content of the response.



7
8
9
# File 'lib/twitch/api_error.rb', line 7

def body
  @body
end

#status_codeObject (readonly)

HTTP status code of the response.



5
6
7
# File 'lib/twitch/api_error.rb', line 5

def status_code
  @status_code
end