Exception: ARI::Error

Inherits:
ARIError
  • Object
show all
Defined in:
lib/ari/errors.rb

Direct Known Subclasses

APIError, ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_body = "", error_info = nil) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ari/errors.rb', line 8

def initialize(response_body = "", error_info = nil)
  if response_body &&  response_body.is_a?(String)
    @response_body = response_body.strip
  else
    @response_body = ''
  end
  if error_info.nil?
    begin
      error_info = ARI::JSON.load(response_body.to_s)
    rescue
      error_info ||= {}
    end
  end
  @error_info = error_info
  message = @response_body
  super(message)
end

Instance Attribute Details

#error_infoObject

Returns the value of attribute error_info.



6
7
8
# File 'lib/ari/errors.rb', line 6

def error_info
  @error_info
end

#response_bodyObject

Returns the value of attribute response_body.



6
7
8
# File 'lib/ari/errors.rb', line 6

def response_body
  @response_body
end