class Ably::Models::ErrorInfo

An exception type encapsulating error information containing an Ably-specific error code and generic status code.

Public Class Methods

new(hash_object) click to toggle source
# File lib/submodules/ably-ruby/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

Public Instance Methods

attributes() click to toggle source
# File lib/submodules/ably-ruby/lib/ably/models/error_info.rb, line 94
def attributes
  @hash_object
end
cause() click to toggle source

Information pertaining to what caused the error where available.

@spec TI1

@return [Ably::Models::ErrorInfo]

# File lib/submodules/ably-ruby/lib/ably/models/error_info.rb, line 69
def cause
  attributes[:cause]
end
code() click to toggle source

Ably error code.

@spec TI1

@return [Integer]

# File lib/submodules/ably-ruby/lib/ably/models/error_info.rb, line 39
def code
  attributes[:code]
end
href() click to toggle source

This is included for REST responses to provide a URL for additional help on the error code.

@spec TI4

@return [String]

# File lib/submodules/ably-ruby/lib/ably/models/error_info.rb, line 49
def href
  attributes[:href]
end
message() click to toggle source

Additional message information, where available.

@spec TI1

@return [String]

# File lib/submodules/ably-ruby/lib/ably/models/error_info.rb, line 59
def message
  attributes[:message]
end
request_id() click to toggle source

If a request fails, the request ID must be included in the ErrorInfo returned to the user.

@spec RSC7c

@return [String]

# File lib/submodules/ably-ruby/lib/ably/models/error_info.rb, line 89
def request_id
  attributes[:request_id]
end
status()
Alias for: status_code
status_code() click to toggle source

HTTP Status Code corresponding to this error, where applicable.

@spec TI1

@return [Integer]

# File lib/submodules/ably-ruby/lib/ably/models/error_info.rb, line 79
def status_code
  attributes[:status_code]
end
Also aliased as: status
to_s() click to toggle source
# File lib/submodules/ably-ruby/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 message.to_s.include?(error_href.to_s)
  "<Error: #{message} (code: #{code}, http status: #{status} request_id: #{request_id} cause: #{cause})>#{see_msg}"
end