code: func extractError(resp *http.Response) error {
  	buf := bytes.NewBuffer(nil)
  
  	// TeeReader returns a Reader that writes to b what it reads from r.Body.
  	reader := io.TeeReader(resp.Body, buf)
  	defer resp.Body.Close()
  	resp.Body = ioutil.NopCloser(buf)
  
  	var out Response
  	if err := json.NewDecoder(reader).Decode(&out); err != nil {
  		return err
  	}
  
  	var errors Errors
  	if errs := out.Response.Errors; len(errs) > 0 {
  		for _, err := range errs {
  			errors = append(errors, Error{
  				Response:  resp,
  				RequestID: out.Request.ID,
  				Code:      err.Code,
  				Message:   err.Message,
  				Field:     err.Field,
  			})
  		}
  	} else {
  		errors = append(errors, Error{
  			Response:  resp,
  			RequestID: out.Request.ID,
  			Code:      strconv.Itoa(resp.StatusCode),
  			Message:   http.StatusText(resp.StatusCode),
  		})
  	}
  
  	return errors
  }
docs: // extractError is used to extract inner/logical errors from the response