Exception: Postio::Error

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

Overview

Base class for every Postio API failure.

All instances carry: status (HTTP code, 0 for transport errors), error_code (the API’s error string), details, request_id, and the raw envelope hash for any field this class doesn’t expose.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status: 0, error_code: nil, details: nil, request_id: nil, envelope: nil, cause: nil) ⇒ Error

Returns a new instance of Error.



12
13
14
15
16
17
18
19
20
# File 'lib/postio/errors.rb', line 12

def initialize(message, status: 0, error_code: nil, details: nil, request_id: nil, envelope: nil, cause: nil)
  super(message)
  @status      = status
  @error_code  = error_code
  @details     = details
  @request_id  = request_id
  @envelope    = envelope
  @cause_error = cause
end

Instance Attribute Details

#cause_errorObject (readonly)

Returns the value of attribute cause_error.



10
11
12
# File 'lib/postio/errors.rb', line 10

def cause_error
  @cause_error
end

#detailsObject (readonly)

Returns the value of attribute details.



10
11
12
# File 'lib/postio/errors.rb', line 10

def details
  @details
end

#envelopeObject (readonly)

Returns the value of attribute envelope.



10
11
12
# File 'lib/postio/errors.rb', line 10

def envelope
  @envelope
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



10
11
12
# File 'lib/postio/errors.rb', line 10

def error_code
  @error_code
end

#request_idObject (readonly)

Returns the value of attribute request_id.



10
11
12
# File 'lib/postio/errors.rb', line 10

def request_id
  @request_id
end

#statusObject (readonly)

Returns the value of attribute status.



10
11
12
# File 'lib/postio/errors.rb', line 10

def status
  @status
end