From 48aaf941069608269e826a5a15081f299a7eca51 Mon Sep 17 00:00:00 2001 From: Philip Hurst Date: Fri, 6 Dec 2024 17:38:59 +0000 Subject: [PATCH] updated WriteInfo to include data from `err` and `stderr` `stderr` contains the error message from the subsystem (pgbackrest or patroni) which is critical for the user to have for troubleshooting. Giving both provides consistency with error reporting in other parts of the support export. --- internal/cmd/export.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/cmd/export.go b/internal/cmd/export.go index d5987a7..0976305 100644 --- a/internal/cmd/export.go +++ b/internal/cmd/export.go @@ -1523,7 +1523,7 @@ func gatherPatroniInfo(ctx context.Context, writeInfo(cmd, err.Error()) return nil } - writeInfo(cmd, strings.TrimSpace(fmt.Sprintf("Error with patronictl list: %s", stderr))) + writeInfo(cmd, strings.TrimSpace(fmt.Sprintf("Error with patronictl list: %s: %s", err, strings.TrimSpace(stderr)))) } buf.Write([]byte(stdout)) @@ -1538,7 +1538,7 @@ func gatherPatroniInfo(ctx context.Context, writeInfo(cmd, err.Error()) return nil } - writeInfo(cmd, strings.TrimSpace(fmt.Sprintf("Error with patronictl history: %s", stderr))) + writeInfo(cmd, strings.TrimSpace(fmt.Sprintf("Error with patronictl history: %s: %s", err, strings.TrimSpace(stderr)))) } buf.Write([]byte(stdout)) @@ -1601,7 +1601,7 @@ func gatherPgBackRestInfo(ctx context.Context, writeInfo(cmd, err.Error()) return nil } - writeInfo(cmd, strings.TrimSpace(fmt.Sprintf("Error with pgbackrest info: %s", stderr))) + writeInfo(cmd, fmt.Sprintf("Error with pgbackrest info: %s: %s", err, strings.TrimSpace(stderr))) } buf.Write([]byte(stdout)) @@ -1616,7 +1616,7 @@ func gatherPgBackRestInfo(ctx context.Context, writeInfo(cmd, err.Error()) return nil } - writeInfo(cmd, strings.TrimSpace(fmt.Sprintf("Error with pgbackrest check: %s", stderr))) + writeInfo(cmd, fmt.Sprintf("Error with pgbackrest check: %s: %s", err, strings.TrimSpace(stderr))) } buf.Write([]byte(stdout))