@@ -73,11 +73,20 @@ defmodule Srh.Http.CommandHandler do
7373 { :ok , result_map } ->
7474 [ result_map | responses ]
7575
76+ { :connection_error , result } ->
77+ { :connection_error , result }
78+
7679 { :redis_error , result } ->
7780 [ result | responses ]
7881 end
7982
80- dispatch_command_array ( rest , connection_info , updated_responses )
83+ case updated_responses do
84+ { :connection_error , result } ->
85+ { :connection_error , result }
86+
87+ _ ->
88+ dispatch_command_array ( rest , connection_info , updated_responses )
89+ end
8190 end
8291
8392 defp dispatch_command_array ( [ ] , _connection_info , responses ) do
@@ -113,7 +122,7 @@ defmodule Srh.Http.CommandHandler do
113122 }
114123
115124 { :error , error } ->
116- decode_error ( error )
125+ decode_error ( error , srh_id )
117126 end
118127
119128 Client . return_worker ( client_pid , worker_pid )
@@ -122,7 +131,7 @@ defmodule Srh.Http.CommandHandler do
122131 result
123132
124133 { :error , error } ->
125- decode_error ( error )
134+ decode_error ( error , srh_id )
126135 end
127136
128137 { :error , msg } ->
@@ -167,7 +176,7 @@ defmodule Srh.Http.CommandHandler do
167176 { :ok , % { result: res } }
168177
169178 { :error , error } ->
170- decode_error ( error )
179+ decode_error ( error , srh_id )
171180 end
172181
173182 { :error , msg } ->
@@ -176,9 +185,13 @@ defmodule Srh.Http.CommandHandler do
176185 end
177186
178187 # Figure out if it's an actual Redis error or a Redix error
179- defp decode_error ( error ) do
188+ defp decode_error ( error , srh_id ) do
180189 case error do
181190 % { reason: :closed } ->
191+ IO . puts (
192+ "WARNING: SRH was unable to connect to the Redis server. Please make sure it is running, and the connection information is correct. SRH ID: #{ srh_id } "
193+ )
194+
182195 {
183196 :connection_error ,
184197 "Unable to connect to the Redis server"
0 commit comments