Exception: TrackerApi::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tracker_api/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wrapped_exception) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tracker_api/error.rb', line 5

def initialize(wrapped_exception)
  @wrapped_exception = wrapped_exception
  @response          = wrapped_exception.response
  message            = if wrapped_exception.is_a?(Faraday::ParsingError)
                         wrapped_exception.message
                       elsif faraday_response_error?(wrapped_exception)
                         wrapped_exception.response.inspect
                       else
                         wrapped_exception.instance_variable_get(:@wrapped_exception).inspect
                       end
  super(message)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/tracker_api/error.rb', line 3

def response
  @response
end

#wrapped_exceptionObject (readonly)

Returns the value of attribute wrapped_exception.



3
4
5
# File 'lib/tracker_api/error.rb', line 3

def wrapped_exception
  @wrapped_exception
end