vendor: update all dependencies

This commit is contained in:
Nick Craig-Wood 2020-06-27 15:45:12 +01:00
parent 61ff7306ae
commit 696d012c05
952 changed files with 121647 additions and 34334 deletions

View file

@ -69,6 +69,8 @@ type Error struct {
// Message is the server response message and is only populated when
// explicitly referenced by the JSON server response.
Message string `json:"message"`
// Details provide more context to an error.
Details []interface{} `json:"details"`
// Body is the raw response returned by the server.
// It is often but not always JSON, depending on how the request fails.
Body string
@ -95,6 +97,16 @@ func (e *Error) Error() string {
if e.Message != "" {
fmt.Fprintf(&buf, "%s", e.Message)
}
if len(e.Details) > 0 {
var detailBuf bytes.Buffer
enc := json.NewEncoder(&detailBuf)
enc.SetIndent("", " ")
if err := enc.Encode(e.Details); err == nil {
fmt.Fprint(&buf, "\nDetails:")
fmt.Fprintf(&buf, "\n%s", detailBuf.String())
}
}
if len(e.Errors) == 0 {
return strings.TrimSpace(buf.String())
}