Skip to content

Commit

Permalink
fix: instance variable @errors not initialized (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
supercaracal authored Nov 19, 2024
1 parent 45ebda5 commit 25c5fd5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/redis_client/cluster/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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. ' \
Expand Down

0 comments on commit 25c5fd5

Please sign in to comment.