Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/pkg/agent/cmd: don't format error message with nil errors #1240

Merged
merged 2 commits into from
Sep 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
explicitly log status code when error is nil
Co-authored-by: Craig MacKenzie <[email protected]>
  • Loading branch information
efd6 and cmacknz authored Sep 22, 2022
commit d5de673ad784bbfb87fb408302c29240796746ce
8 changes: 4 additions & 4 deletions internal/pkg/agent/cmd/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ func performGET(cfg setupConfig, client *kibana.Client, path string, response in
err = fmt.Errorf("http GET request to %s%s fails: %w. Response: %s",
client.Connection.URL, path, err, truncateString(result))
} else {
err = fmt.Errorf("http GET request to %s%s fails. Response: %s",
client.Connection.URL, path, truncateString(result))
err = fmt.Errorf("http GET request to %s%s fails. StatusCode: %d Response: %s",
client.Connection.URL, path, code, truncateString(result))
}
fmt.Fprintf(writer, "%s failed: %s\n", msg, err)
<-time.After(cfg.Kibana.RetrySleepDuration)
Expand All @@ -681,8 +681,8 @@ func performPOST(cfg setupConfig, client *kibana.Client, path string, writer io.
err = fmt.Errorf("http POST request to %s%s fails: %w. Response: %s",
client.Connection.URL, path, err, truncateString(result))
} else {
err = fmt.Errorf("http POST request to %s%s fails. Response: %s",
client.Connection.URL, path, truncateString(result))
err = fmt.Errorf("http POST request to %s%s fails. StatusCode: %d Response: %s",
client.Connection.URL, path, code, truncateString(result))
}
lastErr = err
fmt.Fprintf(writer, "%s failed: %s\n", msg, err)
Expand Down