kubecost / kubectl-cost

CLI for determining the cost of Kubernetes workloads
Apache License 2.0
872 stars 55 forks source link

Check query error before accessing response #127

Closed michaelmdresser closed 2 years ago

michaelmdresser commented 2 years ago

What does this PR change?

We had a bug where failed queries in the TUI would return an error or an empty response but we were trying to access the response before checking the error or the response size. This shifts logic around to handle the error first and then check if the response is empty before trying to access it.

How does this PR impact users? (This is the kind of thing that goes in release notes!)

The TUI logic has been updated to accurately handle a query error case instead of panicking. See https://github.com/kubecost/kubectl-cost/issues/123 for an example.

Links to Issues or ZD tickets this PR addresses or fixes

Locally after observing the panic as described in https://github.com/kubecost/kubectl-cost/issues/123. Now we get an error log instead of panicking. I am still working on fixing the underlying error.