Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: instance variable @errors not initialized #409

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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