Exception: Postscale::APIError

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

Overview

Structured error object returned inside Postscale::Result for API and transport failures. API responses are not raised by public SDK methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, code: "api_error", status_code: nil, request_id: nil, body: nil) ⇒ APIError

Returns a new instance of APIError.



18
19
20
21
22
23
24
# File 'lib/postscale/errors.rb', line 18

def initialize(message:, code: "api_error", status_code: nil, request_id: nil, body: nil)
  @code = code
  @status_code = status_code
  @request_id = request_id
  @body = body
  super(message)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



16
17
18
# File 'lib/postscale/errors.rb', line 16

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



16
17
18
# File 'lib/postscale/errors.rb', line 16

def code
  @code
end

#request_idObject (readonly)

Returns the value of attribute request_id.



16
17
18
# File 'lib/postscale/errors.rb', line 16

def request_id
  @request_id
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



16
17
18
# File 'lib/postscale/errors.rb', line 16

def status_code
  @status_code
end