11 type TransactionError struct {
19 func (e TransactionError) Error() (s string) {
20 s = fmt.Sprintf("request failed: %s", e.URL)
22 s = s + ": " + e.Status
24 if len(e.errors) > 0 {
25 s = s + ": " + strings.Join(e.errors, "; ")
30 func newTransactionError(req *http.Request, resp *http.Response, buf []byte) *TransactionError {
31 var e TransactionError
32 if json.Unmarshal(buf, &e) != nil {
33 // No JSON-formatted error response
39 e.Status = resp.Status
40 e.StatusCode = resp.StatusCode