Class: Ably::Models::ErrorInfo
- Inherits:
-
Object
- Object
- 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 collapse
-
#attributes ⇒ Hash
readonly
Access the protocol message Hash object ruby’fied to use symbolized keys.
-
#code ⇒ Integer
readonly
Ably error code (see ably-common/protocol/errors.json).
-
#message ⇒ String
readonly
Additional reason information, where available.
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
Methods included from Ably::Modules::MessagePack
Constructor Details
#initialize(hash_object) ⇒ ErrorInfo
Returns a new instance of ErrorInfo.
17 18 19 20 |
# File 'lib/ably/models/error_info.rb', line 17 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.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ably/models/error_info.rb', line 14 class ErrorInfo include Ably::Modules::ModelCommon def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end %w(message code status_code).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: #{} (code: #{code}, http status: #{status})" end end |
#code ⇒ Integer (readonly)
Returns Ably error code (see ably-common/protocol/errors.json).
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ably/models/error_info.rb', line 14 class ErrorInfo include Ably::Modules::ModelCommon def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end %w(message code status_code).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: #{} (code: #{code}, http status: #{status})" end end |
#message ⇒ String (readonly)
Returns Additional reason information, where available.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ably/models/error_info.rb', line 14 class ErrorInfo include Ably::Modules::ModelCommon def initialize(hash_object) @raw_hash_object = hash_object @hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) end %w(message code status_code).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: #{} (code: #{code}, http status: #{status})" end end |
Instance Method Details
#to_s ⇒ Object
33 34 35 |
# File 'lib/ably/models/error_info.rb', line 33 def to_s "Error: #{} (code: #{code}, http status: #{status})" end |