Sha256: cd058398d0c574d1c3b1c91e39f01fc30462a0888b84a2ac508754f99bbd73d9
Contents?: true
Size: 1.08 KB
Versions: 22
Compression:
Stored size: 1.08 KB
Contents
module Ably::Models # An exception type encapsulating error information containing # an Ably-specific error code and generic status code. # # @!attribute [r] message # @return [String] Additional reason information, where available # @!attribute [r] code # @return [Integer] Ably error code (see ably-common/protocol/errors.json) # @!attribute [r] status # @return [Integer] HTTP Status Code corresponding to this error, where applicable # @!attribute [r] hash # @return [Hash] Access the protocol message Hash object ruby'fied to use symbolized keys # 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 hash[attribute.to_sym] end end alias_method :status, :status_code def hash @hash_object end def to_s "Error: #{message} (code: #{code}, http status: #{status})" end end end
Version data entries
22 entries across 22 versions & 2 rubygems