Exception: Ecertic::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Ecertic::Error
- Defined in:
- lib/ecertic/errors.rb
Overview
Error is the base error from which all other more specific Ecertic errors derive.
Direct Known Subclasses
APIConnectionError, APIError, AuthenticationError, InvalidRequestError, SignatureVerificationError
Instance Attribute Summary collapse
-
#http_body ⇒ Object
readonly
Returns the value of attribute http_body.
-
#http_headers ⇒ Object
readonly
Returns the value of attribute http_headers.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(message = nil, http_status: nil, http_headers: nil, http_body: nil, response: nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(message = nil, http_status: nil, http_headers: nil, http_body: nil, response: nil) ⇒ Error
Returns a new instance of Error.
12 13 14 15 16 17 18 |
# File 'lib/ecertic/errors.rb', line 12 def initialize( = nil, http_status: nil, http_headers: nil, http_body: nil, response: nil) @message = @http_status = http_status || response&.status @http_headers = http_headers || response&.headers @http_body = http_body || response&.body @response = response end |
Instance Attribute Details
#http_body ⇒ Object (readonly)
Returns the value of attribute http_body.
9 10 11 |
# File 'lib/ecertic/errors.rb', line 9 def http_body @http_body end |
#http_headers ⇒ Object (readonly)
Returns the value of attribute http_headers.
8 9 10 |
# File 'lib/ecertic/errors.rb', line 8 def http_headers @http_headers end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
7 8 9 |
# File 'lib/ecertic/errors.rb', line 7 def http_status @http_status end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/ecertic/errors.rb', line 6 def @message end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/ecertic/errors.rb', line 10 def response @response end |
Instance Method Details
#to_s ⇒ Object
20 21 22 23 |
# File 'lib/ecertic/errors.rb', line 20 def to_s status_string = @http_status.nil? ? "" : "(Status #{@http_status}) " "#{status_string}#{@message}" end |