Skip to content

Commit

Permalink
updated WriteInfo to include data from err and stderr
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
Philip Hurst committed Dec 6, 2024
1 parent 62625aa commit 48aaf94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down

0 comments on commit 48aaf94

Please sign in to comment.