Exception: MisarReach::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/misar_reach/errors.rb

Overview

Base error raised for any non-2xx MisarReach API response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, message, code: nil, retry_after: nil, body: nil) ⇒ ApiError

Returns a new instance of ApiError.



6
7
8
9
10
11
12
# File 'lib/misar_reach/errors.rb', line 6

def initialize(status, message, code: nil, retry_after: nil, body: nil)
  @status      = status
  @code        = code
  @retry_after = retry_after
  @body        = body
  super("misar-reach: API error #{status}#{code ? " (#{code})" : ""}: #{message}")
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/misar_reach/errors.rb', line 4

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/misar_reach/errors.rb', line 4

def code
  @code
end

#retry_afterObject (readonly)

Returns the value of attribute retry_after.



4
5
6
# File 'lib/misar_reach/errors.rb', line 4

def retry_after
  @retry_after
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/misar_reach/errors.rb', line 4

def status
  @status
end