1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
15 type TransactionError struct {
23 func (e TransactionError) Error() (s string) {
24 s = fmt.Sprintf("request failed: %s", e.URL.String())
26 s = s + ": " + e.Status
28 if len(e.errors) > 0 {
29 s = s + ": " + strings.Join(e.errors, "; ")
34 func newTransactionError(req *http.Request, resp *http.Response, buf []byte) *TransactionError {
35 var e TransactionError
36 if json.Unmarshal(buf, &e) != nil {
37 // No JSON-formatted error response
43 e.Status = resp.Status
44 e.StatusCode = resp.StatusCode