Exception: Ably::Models::ErrorInfo
- Inherits:
-
Exceptions::BaseAblyException
- Object
- StandardError
- Exceptions::BaseAblyException
- Ably::Models::ErrorInfo
- Includes:
- Ably::Modules::ModelCommon
- Defined in:
- lib/ably/models/error_info.rb
Overview
An exception type encapsulating error information containing an Ably-specific error code and generic status code.
Instance Attribute Summary
Attributes included from Ably::Modules::ModelCommon
Instance Method Summary collapse
- #attributes ⇒ Object
-
#cause ⇒ Ably::Models::ErrorInfo
Information pertaining to what caused the error where available.
-
#code ⇒ Integer
Ably error code.
-
#href ⇒ String
This is included for REST responses to provide a URL for additional help on the error code.
-
#initialize(hash_object) ⇒ ErrorInfo
constructor
A new instance of ErrorInfo.
-
#message ⇒ String
Additional message information, where available.
-
#request_id ⇒ String
If a request fails, the request ID must be included in the ErrorInfo returned to the user.
-
#status_code ⇒ Integer
(also: #status)
HTTP Status Code corresponding to this error, where applicable.
- #to_s ⇒ Object
Methods included from Ably::Modules::ModelCommon
#==, #[], #as_json, included, #to_json
Methods included from Ably::Modules::MessagePack
Methods inherited from Exceptions::BaseAblyException
Constructor Details
#initialize(hash_object) ⇒ ErrorInfo
Returns a new instance of ErrorInfo.
28 29 30 31 |
# File 'lib/ably/models/error_info.rb', line 28 def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end |
Instance Method Details
#attributes ⇒ Object
94 95 96 |
# File 'lib/ably/models/error_info.rb', line 94 def attributes @hash_object end |
#cause ⇒ Ably::Models::ErrorInfo
Information pertaining to what caused the error where available.
69 70 71 |
# File 'lib/ably/models/error_info.rb', line 69 def cause attributes[:cause] end |
#code ⇒ Integer
Ably error code.
39 40 41 |
# File 'lib/ably/models/error_info.rb', line 39 def code attributes[:code] end |
#href ⇒ String
This is included for REST responses to provide a URL for additional help on the error code.
49 50 51 |
# File 'lib/ably/models/error_info.rb', line 49 def href attributes[:href] end |
#message ⇒ String
Additional message information, where available.
59 60 61 |
# File 'lib/ably/models/error_info.rb', line 59 def attributes[:message] end |
#request_id ⇒ String
If a request fails, the request ID must be included in the ErrorInfo returned to the user.
89 90 91 |
# File 'lib/ably/models/error_info.rb', line 89 def request_id attributes[:request_id] end |
#status_code ⇒ Integer Also known as: status
HTTP Status Code corresponding to this error, where applicable.
79 80 81 |
# File 'lib/ably/models/error_info.rb', line 79 def status_code attributes[:status_code] end |
#to_s ⇒ Object
98 99 100 101 102 |
# File 'lib/ably/models/error_info.rb', line 98 def to_s error_href = href || (code ? "https://help.ably.io/error/#{code}" : '') see_msg = " -> see #{error_href} for help" unless .to_s.include?(error_href.to_s) "<Error: #{} (code: #{code}, http status: #{status} request_id: #{request_id} cause: #{cause})>#{see_msg}" end |