Class: RedisClient::Cluster::CommandErrorCollection

Inherits:
Error
  • Object
show all
Defined in:
lib/redis_client/cluster/errors.rb

Overview

Raised when error occurs on any node of cluster.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ CommandErrorCollection

Returns a new instance of CommandErrorCollection.



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/redis_client/cluster/errors.rb', line 35

def initialize(errors)
  @errors = {}
  if !errors.is_a?(Hash) || errors.empty?
    super('')
    return
  end

  @errors = errors
  messages = @errors.map { |node_key, error| "#{node_key}: #{error.message}" }
  super("Command errors were replied on any node: #{messages.join(', ')}")
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



33
34
35
# File 'lib/redis_client/cluster/errors.rb', line 33

def errors
  @errors
end