Skip to content

Commit 25c5fd5

Browse files
authored
fix: instance variable @errors not initialized (#409)
1 parent 45ebda5 commit 25c5fd5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/redis_client/cluster/errors.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,16 @@ def self.with_errors(errors)
4343
if !errors.is_a?(Hash) || errors.empty?
4444
new(errors.to_s).with_errors(EMPTY_HASH)
4545
else
46-
messages = errors.map { |node_key, error| "#{node_key}: (#{error.class}) #{error.message}" }
46+
messages = errors.map { |node_key, error| "#{node_key}: (#{error.class}) #{error.message}" }.freeze
4747
new(messages.join(', ')).with_errors(errors)
4848
end
4949
end
5050

51+
def initialize(error_message = nil)
52+
@errors = nil
53+
super
54+
end
55+
5156
def with_errors(errors)
5257
@errors = errors if @errors.nil?
5358
self
@@ -61,7 +66,7 @@ def self.from_command(command)
6166
end
6267

6368
class NodeMightBeDown < Error
64-
def initialize(_ = '')
69+
def initialize(_error_message = nil)
6570
super(
6671
'The client is trying to fetch the latest cluster state ' \
6772
'because a subset of nodes might be down. ' \

0 commit comments

Comments
 (0)