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:
parent
08fde3a4ff
commit
593e48e826
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
cli: prevent a panic when the Nomad API returns an error while collecting a debug bundle
|
||||||
|
```
|
|
@ -1404,7 +1404,7 @@ func writeResponseStreamOrErrorToFile[T any](obj []T, apiErr error, getWriterFn
|
||||||
defer writer.Close()
|
defer writer.Close()
|
||||||
|
|
||||||
if apiErr != nil {
|
if apiErr != nil {
|
||||||
wrapped := errorWrapper{Error: err.Error()}
|
wrapped := errorWrapper{Error: apiErr.Error()}
|
||||||
return writeJSON(wrapped, writer)
|
return writeJSON(wrapped, writer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue