Skip to content

Commit 3cf6f40

Browse files
Fix: Prevent nil errors in setupLog.Error to ensure proper logging
Closes; operator-framework#1566 Closes: operator-framework#1556
1 parent 9695f63 commit 3cf6f40

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

catalogd/cmd/catalogd/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ func main() {
145145
}
146146

147147
if (certFile != "" && keyFile == "") || (certFile == "" && keyFile != "") {
148-
setupLog.Error(nil, "unable to configure TLS certificates: tls-cert and tls-key flags must be used together")
148+
setupLog.Error(fmt.Errorf("unable to configure TLS certificates"), "tls-cert and tls-key flags must be used together")
149149
os.Exit(1)
150150
}
151151

152152
if metricsAddr != "" && certFile == "" && keyFile == "" {
153-
setupLog.Error(nil, "metrics-bind-address requires tls-cert and tls-key flags to be set")
153+
setupLog.Error(fmt.Errorf("unable to configure metrics-bind-address"), "metrics-bind-address requires tls-cert and tls-key flags to be set")
154154
os.Exit(1)
155155
}
156156

cmd/operator-controller/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ func main() {
132132
}
133133

134134
if (certFile != "" && keyFile == "") || (certFile == "" && keyFile != "") {
135-
setupLog.Error(nil, "unable to configure TLS certificates: tls-cert and tls-key flags must be used together")
135+
setupLog.Error(fmt.Errorf("unable to configure TLS certificates"), "tls-cert and tls-key flags must be used together")
136136
os.Exit(1)
137137
}
138138

139139
if metricsAddr != "" && certFile == "" && keyFile == "" {
140-
setupLog.Error(nil, "metrics-bind-address requires tls-cert and tls-key flags to be set")
140+
setupLog.Error(fmt.Errorf("unable to configure metrics-bind-address"), "metrics-bind-address requires tls-cert and tls-key flags to be set")
141141
os.Exit(1)
142142
}
143143

0 commit comments

Comments
 (0)