@@ -174,23 +174,23 @@ public static function createConnection($dsn, array $options = [])
174
174
try {
175
175
@$ redis ->{$ connect }($ hosts [0 ]['host ' ] ?? $ hosts [0 ]['path ' ], $ hosts [0 ]['port ' ] ?? null , $ params ['timeout ' ], (string ) $ params ['persistent_id ' ], $ params ['retry_interval ' ]);
176
176
} catch (\RedisException $ e ) {
177
- throw new InvalidArgumentException (sprintf ('Redis connection failed (%s): "%s". ' , $ e ->getMessage (), $ dsn ));
177
+ throw new InvalidArgumentException (sprintf ('Redis connection "%s" failed: ' , $ dsn ). $ e ->getMessage ());
178
178
}
179
179
180
180
set_error_handler (function ($ type , $ msg ) use (&$ error ) { $ error = $ msg ; });
181
181
$ isConnected = $ redis ->isConnected ();
182
182
restore_error_handler ();
183
183
if (!$ isConnected ) {
184
184
$ error = preg_match ('/^Redis::p?connect\(\): (.*)/ ' , $ error , $ error ) ? sprintf (' (%s) ' , $ error [1 ]) : '' ;
185
- throw new InvalidArgumentException (sprintf ('Redis connection failed%s: "%s". ' , $ error , $ dsn ));
185
+ throw new InvalidArgumentException (sprintf ('Redis connection "%s" failed: ' , $ dsn ). $ error . ' . ' );
186
186
}
187
187
188
188
if ((null !== $ auth && !$ redis ->auth ($ auth ))
189
189
|| ($ params ['dbindex ' ] && !$ redis ->select ($ params ['dbindex ' ]))
190
190
|| ($ params ['read_timeout ' ] && !$ redis ->setOption (\Redis::OPT_READ_TIMEOUT , $ params ['read_timeout ' ]))
191
191
) {
192
192
$ e = preg_replace ('/^ERR / ' , '' , $ redis ->getLastError ());
193
- throw new InvalidArgumentException (sprintf ('Redis connection failed (%s): "%s". ' , $ e , $ dsn ));
193
+ throw new InvalidArgumentException (sprintf ('Redis connection "%s" failed: ' , $ dsn ). $ e . ' . ' );
194
194
}
195
195
196
196
if (0 < $ params ['tcp_keepalive ' ] && \defined ('Redis::OPT_TCP_KEEPALIVE ' )) {
@@ -215,7 +215,7 @@ public static function createConnection($dsn, array $options = [])
215
215
try {
216
216
$ redis = new $ class ($ hosts , $ params );
217
217
} catch (\RedisClusterException $ e ) {
218
- throw new InvalidArgumentException (sprintf ('Redis connection failed (%s): "%s". ' , $ e ->getMessage (), $ dsn ));
218
+ throw new InvalidArgumentException (sprintf ('Redis connection "%s" failed: ' , $ dsn ). $ e ->getMessage ());
219
219
}
220
220
221
221
if (0 < $ params ['tcp_keepalive ' ] && \defined ('Redis::OPT_TCP_KEEPALIVE ' )) {
@@ -230,7 +230,7 @@ public static function createConnection($dsn, array $options = [])
230
230
try {
231
231
$ redis = new $ class (null , $ hosts , $ params ['timeout ' ], $ params ['read_timeout ' ], (bool ) $ params ['persistent ' ]);
232
232
} catch (\RedisClusterException $ e ) {
233
- throw new InvalidArgumentException (sprintf ('Redis connection failed (%s): "%s". ' , $ e ->getMessage (), $ dsn ));
233
+ throw new InvalidArgumentException (sprintf ('Redis connection "%s" failed: ' , $ dsn ). $ e ->getMessage ());
234
234
}
235
235
236
236
if (0 < $ params ['tcp_keepalive ' ] && \defined ('Redis::OPT_TCP_KEEPALIVE ' )) {
0 commit comments