Is there any way to get the net/http StatusCode from a deeply nested function call?
Explicitly I’m calling…
clusterHealth, err := c.client.Operator().AutopilotServerHealth(&queryOptions)
Something I’d like to do is like…
if err != nil && clusterHealth.StatusCode != 429 {
....
}
However at the moment I’m doing:
if err != nil && !strings.Contains(err.Error(), "Unexpected response code: 429") {
...
}
I’m wondering if there’s a better way to do this? I know the API exposes the http client options, I’m just curious if others out there have solved this in a more elegant way than checking if a string matches.