Exception: Tvdb2::RequestError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tvdb2/request_error.rb

Overview

Exception raised when an http request to an endpoint return a status code different from 200 or 404.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ RequestError

Returns a new instance of RequestError

Parameters:

  • response (HTTParty::Response)

    the HTTParty response object.



10
11
12
13
14
15
# File 'lib/tvdb2/request_error.rb', line 10

def initialize(response)
  super(response['Error'] || response.message)
  @response = response
  @code = response.code
  @error = response['Error']
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code



7
8
9
# File 'lib/tvdb2/request_error.rb', line 7

def code
  @code
end

#errorObject (readonly)

Returns the value of attribute error



7
8
9
# File 'lib/tvdb2/request_error.rb', line 7

def error
  @error
end

#responseObject (readonly)

Returns the value of attribute response



7
8
9
# File 'lib/tvdb2/request_error.rb', line 7

def response
  @response
end