cli: prevent panic on operator debug (#14992)

If the API returns an error during debug bundle collection the CLI was
expanding the wrong error object, resulting in a panic since `err` is
`nil`.
This commit is contained in:
Luiz Aoqui
2022-10-20 15:53:58 -04:00
committed by GitHub
parent 67fd9ffee1
commit 9d28d9eb47
2 changed files with 4 additions and 1 deletions

View File

@@ -1404,7 +1404,7 @@ func writeResponseStreamOrErrorToFile[T any](obj []T, apiErr error, getWriterFn
defer writer.Close()
if apiErr != nil {
wrapped := errorWrapper{Error: err.Error()}
wrapped := errorWrapper{Error: apiErr.Error()}
return writeJSON(wrapped, writer)
}