File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
16
16
"github.com/redis/go-redis/v9/internal"
17
17
"github.com/redis/go-redis/v9/internal/pool"
18
18
"github.com/redis/go-redis/v9/internal/rand"
19
+ "github.com/redis/go-redis/v9/internal/util"
19
20
)
20
21
21
22
//------------------------------------------------------------------------------
@@ -782,7 +783,20 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
782
783
for err := range errCh {
783
784
errs = append (errs , err )
784
785
}
785
- return "" , fmt .Errorf ("redis: all sentinels specified in configuration are unreachable: %w" , errors .Join (errs ... ))
786
+ return "" , fmt .Errorf ("redis: all sentinels specified in configuration are unreachable: %s" , joinErrors (errs ))
787
+ }
788
+
789
+ func joinErrors (errs []error ) string {
790
+ if len (errs ) == 1 {
791
+ return errs [0 ].Error ()
792
+ }
793
+
794
+ b := []byte (errs [0 ].Error ())
795
+ for _ , err := range errs [1 :] {
796
+ b = append (b , '\n' )
797
+ b = append (b , err .Error ()... )
798
+ }
799
+ return util .BytesToString (b )
786
800
}
787
801
788
802
func (c * sentinelFailover ) replicaAddrs (ctx context.Context , useDisconnected bool ) ([]string , error ) {
You can’t perform that action at this time.
0 commit comments