From bfbd8513da5c450303985dc2770d487be07cc700 Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Tue, 19 Nov 2024 09:41:27 +0900 Subject: [PATCH] fix: instance variable @errors not initialized --- lib/redis_client/cluster/errors.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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. ' \