Exception: Ably::Models::ErrorInfo
- Inherits:
-
Exceptions::BaseAblyException
- Object
- StandardError
- Exceptions::BaseAblyException
- Ably::Models::ErrorInfo
- Includes:
- Ably::Modules::ModelCommon
- Defined in:
- lib/submodules/ably-ruby/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 collapse
-
#attributes ⇒ Hash
readonly
Access the protocol message Hash object ruby’fied to use symbolized keys.
-
#cause ⇒ Integer
readonly
HTTP Status Code corresponding to this error, where applicable (#TI1).
-
#code ⇒ Integer
readonly
Ably error code (see ably-common/protocol/errors.json).
-
#message ⇒ String
readonly
Additional reason information, where available.
-
#request_id ⇒ Integer
readonly
HTTP RequestId corresponding to this error, where applicable (#RSC7c).
Attributes included from Ably::Modules::ModelCommon
Instance Method Summary collapse
-
#initialize(hash_object) ⇒ ErrorInfo
constructor
A new instance of ErrorInfo.
- #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.
40 41 42 43 |
# File 'lib/submodules/ably-ruby/lib/ably/models/error_info.rb', line 40 def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end |
Instance Attribute Details
#attributes ⇒ Hash (readonly)
Returns Access the protocol message Hash object ruby’fied to use symbolized keys.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/submodules/ably-ruby/lib/ably/models/error_info.rb', line 37 class ErrorInfo < Ably::Exceptions::BaseAblyException include Ably::Modules::ModelCommon def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end %w(message code href status_code request_id cause).each do |attribute| define_method attribute do attributes[attribute.to_sym] end end alias_method :status, :status_code def attributes @hash_object end 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 end |
#cause ⇒ Integer (readonly)
Returns HTTP Status Code corresponding to this error, where applicable (#TI1).
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/submodules/ably-ruby/lib/ably/models/error_info.rb', line 37 class ErrorInfo < Ably::Exceptions::BaseAblyException include Ably::Modules::ModelCommon def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end %w(message code href status_code request_id cause).each do |attribute| define_method attribute do attributes[attribute.to_sym] end end alias_method :status, :status_code def attributes @hash_object end 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 end |
#code ⇒ Integer (readonly)
Returns Ably error code (see ably-common/protocol/errors.json).
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/submodules/ably-ruby/lib/ably/models/error_info.rb', line 37 class ErrorInfo < Ably::Exceptions::BaseAblyException include Ably::Modules::ModelCommon def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end %w(message code href status_code request_id cause).each do |attribute| define_method attribute do attributes[attribute.to_sym] end end alias_method :status, :status_code def attributes @hash_object end 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 end |
#message ⇒ String (readonly)
Returns Additional reason information, where available.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/submodules/ably-ruby/lib/ably/models/error_info.rb', line 37 class ErrorInfo < Ably::Exceptions::BaseAblyException include Ably::Modules::ModelCommon def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end %w(message code href status_code request_id cause).each do |attribute| define_method attribute do attributes[attribute.to_sym] end end alias_method :status, :status_code def attributes @hash_object end 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 end |
#request_id ⇒ Integer (readonly)
Returns HTTP RequestId corresponding to this error, where applicable (#RSC7c).
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/submodules/ably-ruby/lib/ably/models/error_info.rb', line 37 class ErrorInfo < Ably::Exceptions::BaseAblyException include Ably::Modules::ModelCommon def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end %w(message code href status_code request_id cause).each do |attribute| define_method attribute do attributes[attribute.to_sym] end end alias_method :status, :status_code def attributes @hash_object end 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 end |
Instance Method Details
#to_s ⇒ Object
56 57 58 59 60 |
# File 'lib/submodules/ably-ruby/lib/ably/models/error_info.rb', line 56 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 |