Currently any errors which come back from the VES API are unmarshalled into the following struct:
type ErrorResponse struct {
Errors []Error `json:"errors"`
}
type Error struct {
Status Status `json:"status,omitempty"`
Code Status `json:"code,omitempty"`
Title string `json:"title"`
Detail string `json:"detail,omitempty"`
}
Unfortunately the VES API isn't so consistent. When Supplying the following test registration number ER19THR
as documented in the Test API response document it is supposed to return a 429 Too Many Requests
{
"message": "Too Many Requests"
}
func (r *Request) Do(v interface{}) (*http.Response, error) {
if r.e != nil {
return nil, r.e
}
resp, err := r.c.httpClient.Do(r.Request)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
var errResp ErrorResponse
err := json.NewDecoder(resp.Body).Decode(&errResp)
if err != nil {
return resp, err
}
return resp, errResp.Errors[0]
}
Will make a PR when we get around to fixing it on our end if you don't fix it before us.