Skip to content

Commit 44f966f

Browse files
committed
dexop: better error handling for certs
1 parent 2ea0d15 commit 44f966f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

go/dexop/dex/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ func newDexClient(hostAndPort, caPath, clientKey, clientCrt string) (dexapi.DexC
104104
cPool := x509.NewCertPool()
105105
caCert, err := os.ReadFile(caPath)
106106
if err != nil {
107-
return nil, fmt.Errorf("invalid CA crt file: %s", caPath)
107+
return nil, fmt.Errorf("invalid CA crt file (%s): %w", caPath, err)
108108
}
109109
if !cPool.AppendCertsFromPEM(caCert) {
110110
return nil, fmt.Errorf("failed to parse CA crt")
111111
}
112112

113113
clientCert, err := tls.LoadX509KeyPair(clientCrt, clientKey)
114114
if err != nil {
115-
return nil, fmt.Errorf("invalid client crt file: %s", clientCrt)
115+
return nil, fmt.Errorf("invalid client crt(%s) or key(%s) file: %w", clientCrt, clientKey, err)
116116
}
117117

118118
clientTLSConfig := &tls.Config{

0 commit comments

Comments
 (0)