Skip to content

Commit 57dd674

Browse files
committed
dbutil: Make error messages slightly more useful
Change-Id: I060198465bd47e2c88269669950c201f2cea3a58
1 parent 25b85ea commit 57dd674

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dbutil/mysql.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@ func registerSqlTLSConfig(cfg *SqlConfig, configId string) error {
188188
rootCertPool := x509.NewCertPool()
189189
pem, err := ioutil.ReadFile(cfg.RootCertPath)
190190
if err != nil {
191-
return fmt.Errorf("failed reading root certificate: %v", err)
191+
return fmt.Errorf("failed reading root certificate in %v: %v", cfg.RootCertPath, err)
192192
}
193193
if ok := rootCertPool.AppendCertsFromPEM(pem); !ok {
194-
return fmt.Errorf("failed to append PEM to cert pool")
194+
return fmt.Errorf("failed to add root certificate in %v to cert pool", cfg.RootCertPath)
195195
}
196196
ckpair, err := tls.LoadX509KeyPair(cfg.ClientCertPath, cfg.ClientKeyPath)
197197
if err != nil {
198-
return fmt.Errorf("failed loading client key pair: %v", err)
198+
return fmt.Errorf("failed loading client key pair (%v, %v): %v", cfg.ClientCertPath, cfg.ClientKeyPath, err)
199199
}
200200
clientCert := []tls.Certificate{ckpair}
201201
return mysql.RegisterTLSConfig(configId, &tls.Config{

0 commit comments

Comments
 (0)