Exception: SmartHR::APIConnectionError

Inherits:
Error
  • Object
show all
Defined in:
lib/smarthr.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#error_response, #status

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Error

from_response

Constructor Details

#initialize(message, original_error = nil) ⇒ APIConnectionError

Returns a new instance of APIConnectionError.



29
30
31
32
33
34
35
36
37
# File 'lib/smarthr.rb', line 29

def initialize(message, original_error = nil)
  @original_error = original_error

  if original_error && original_error.response.is_a?(Hash)
    super(message, original_error.response[:status], original_error.response[:body])
  else
    super(message)
  end
end

Instance Attribute Details

#original_errorObject (readonly)

Returns the value of attribute original_error.



27
28
29
# File 'lib/smarthr.rb', line 27

def original_error
  @original_error
end

Class Method Details

.faraday_error(e) ⇒ Object



23
24
25
# File 'lib/smarthr.rb', line 23

def self.faraday_error(e)
  new("Connection with SmartHR API server failed. #{e.message}", e)
end