Exception: TesoteSdk::Error
- Inherits:
-
StandardError
- Object
- StandardError
- TesoteSdk::Error
- Defined in:
- lib/tesote_sdk/errors.rb
Overview
Base class. Catch-all only as last resort.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attempts ⇒ Object
readonly
Returns the value of attribute attempts.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#error_id ⇒ Object
readonly
Returns the value of attribute error_id.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#request_summary ⇒ Object
readonly
Returns the value of attribute request_summary.
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
-
#retry_after ⇒ Object
readonly
Returns the value of attribute retry_after.
Instance Method Summary collapse
- #cause ⇒ Object
-
#initialize(message, error_code: nil, http_status: nil, request_id: nil, error_id: nil, retry_after: nil, response_body: nil, request_summary: nil, attempts: nil, cause: nil) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(message, error_code: nil, http_status: nil, request_id: nil, error_id: nil, retry_after: nil, response_body: nil, request_summary: nil, attempts: nil, cause: nil) ⇒ Error
Returns a new instance of Error.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tesote_sdk/errors.rb', line 9 def initialize(, error_code: nil, http_status: nil, request_id: nil, error_id: nil, retry_after: nil, response_body: nil, request_summary: nil, attempts: nil, cause: nil) super() @error_code = error_code @http_status = http_status @request_id = request_id @error_id = error_id @retry_after = retry_after @response_body = response_body @request_summary = request_summary @attempts = attempts @cause_override = cause end |
Instance Attribute Details
#attempts ⇒ Object (readonly)
Returns the value of attribute attempts.
6 7 8 |
# File 'lib/tesote_sdk/errors.rb', line 6 def attempts @attempts end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
6 7 8 |
# File 'lib/tesote_sdk/errors.rb', line 6 def error_code @error_code end |
#error_id ⇒ Object (readonly)
Returns the value of attribute error_id.
6 7 8 |
# File 'lib/tesote_sdk/errors.rb', line 6 def error_id @error_id end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
6 7 8 |
# File 'lib/tesote_sdk/errors.rb', line 6 def http_status @http_status end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
6 7 8 |
# File 'lib/tesote_sdk/errors.rb', line 6 def request_id @request_id end |
#request_summary ⇒ Object (readonly)
Returns the value of attribute request_summary.
6 7 8 |
# File 'lib/tesote_sdk/errors.rb', line 6 def request_summary @request_summary end |
#response_body ⇒ Object (readonly)
Returns the value of attribute response_body.
6 7 8 |
# File 'lib/tesote_sdk/errors.rb', line 6 def response_body @response_body end |
#retry_after ⇒ Object (readonly)
Returns the value of attribute retry_after.
6 7 8 |
# File 'lib/tesote_sdk/errors.rb', line 6 def retry_after @retry_after end |
Instance Method Details
#cause ⇒ Object
31 32 33 |
# File 'lib/tesote_sdk/errors.rb', line 31 def cause @cause_override || super end |
#inspect ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/tesote_sdk/errors.rb', line 49 def inspect parts = [ "code=#{error_code.inspect}", "status=#{http_status.inspect}", "request_id=#{request_id.inspect}", "attempts=#{attempts.inspect}" ].join(' ') "#<#{self.class.name}: #{} (#{parts})>" end |
#to_h ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/tesote_sdk/errors.rb', line 35 def to_h { error_code: error_code, message: , http_status: http_status, request_id: request_id, error_id: error_id, retry_after: retry_after, response_body: response_body, request_summary: request_summary, attempts: attempts } end |