Skip to content

Commit a66fb03

Browse files
Fix: Prevent nil errors in setupLog.Error to ensure proper logging
Closes; #1566 Closes: #1556
1 parent 1dd674a commit a66fb03

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

catalogd/cmd/catalogd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ func main() {
143143
}
144144

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

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

cmd/operator-controller/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ func main() {
128128
}
129129

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

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

0 commit comments

Comments
 (0)