Exception: OmniSocials::APIError

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

Overview

A non-2xx response from the OmniSocials API.

Attributes:

status - HTTP status code (nil for client-side failures such as a
       missing API key at construction time).
code   - machine-readable error code from the API body
       ({"error" => {"code" => ..., "message" => ...}}) when present.
body   - the parsed response body (Hash) when the response was JSON,
       otherwise the raw response text, or nil.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of APIError.



32
33
34
35
36
37
# File 'lib/omnisocials/errors.rb', line 32

def initialize(message, status: nil, code: nil, body: nil)
  super(message)
  @status = status
  @code = code
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



30
31
32
# File 'lib/omnisocials/errors.rb', line 30

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



30
31
32
# File 'lib/omnisocials/errors.rb', line 30

def code
  @code
end

#statusObject (readonly)

Returns the value of attribute status.



30
31
32
# File 'lib/omnisocials/errors.rb', line 30

def status
  @status
end