diff --git a/lib/redis_client/cluster/errors.rb b/lib/redis_client/cluster/errors.rb index a0be5f2f..67f661cc 100644 --- a/lib/redis_client/cluster/errors.rb +++ b/lib/redis_client/cluster/errors.rb @@ -43,11 +43,16 @@ def self.with_errors(errors) if !errors.is_a?(Hash) || errors.empty? new(errors.to_s).with_errors(EMPTY_HASH) else - messages = errors.map { |node_key, error| "#{node_key}: (#{error.class}) #{error.message}" } + messages = errors.map { |node_key, error| "#{node_key}: (#{error.class}) #{error.message}" }.freeze new(messages.join(', ')).with_errors(errors) end end + def initialize(error_message = nil) + @errors = nil + super + end + def with_errors(errors) @errors = errors if @errors.nil? self @@ -61,7 +66,7 @@ def self.from_command(command) end class NodeMightBeDown < Error - def initialize(_ = '') + def initialize(_error_message = nil) super( 'The client is trying to fetch the latest cluster state ' \ 'because a subset of nodes might be down. ' \