File tree Expand file tree Collapse file tree 1 file changed +7
-20
lines changed Expand file tree Collapse file tree 1 file changed +7
-20
lines changed Original file line number Diff line number Diff line change 44 "context"
55 "crypto/x509"
66 "encoding/pem"
7+ "fmt"
78 "io/ioutil"
89 "os"
910 "path/filepath"
@@ -62,27 +63,13 @@ func WithRequestsType(requestsType string) Option {
6263// (connection string will be required string param of ydb.Open)
6364func WithConnectionString (connectionString string ) Option {
6465 return func (ctx context.Context , c * connection ) error {
65- var (
66- urls = []string {
67- connectionString ,
68- "grpcs://" + connectionString ,
69- }
70- issues = make ([]error , 0 , len (urls ))
71- )
72- for _ , url := range urls {
73- options , err := dsn .Parse (url )
74- if err == nil {
75- c .options = append (c .options , options ... )
76- return nil
77- }
78- issues = append (issues , err )
79- }
80- if len (issues ) > 0 {
81- return xerrors .WithStackTrace (xerrors .NewWithIssues (
82- "parse connection string '" + connectionString + "' failed:" ,
83- issues ... ,
84- ))
66+ options , err := dsn .Parse (connectionString )
67+ if err != nil {
68+ return xerrors .WithStackTrace (
69+ fmt .Errorf ("parse connection string '%s' failed: %w" , connectionString , err ),
70+ )
8571 }
72+ c .options = append (c .options , options ... )
8673 return nil
8774 }
8875}
You can’t perform that action at this time.
0 commit comments