Currently, the client tries to unmarshal the response into the declared type. When there is an error like Unauthorized this ends up failing with a a message like json.Unmarshal parse error U at line 1:1, which isn't very helpful to the end user.
Upon failing to decode a response, we should fall back to a more general conversion and use that in our error reporting.
Currently, the client tries to unmarshal the response into the declared type. When there is an error like
Unauthorizedthis ends up failing with a a message likejson.Unmarshal parse errorUat line 1:1, which isn't very helpful to the end user.Upon failing to decode a response, we should fall back to a more general conversion and use that in our error reporting.