aboutsummaryrefslogtreecommitdiff
path: root/errors.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-02-04 23:29:09 +0100
committerStefan Majewsky <majewsky@gmx.net>2018-02-04 23:29:09 +0100
commitfafac750baa70812432020784cc5ba2cc23224cc (patch)
tree2b0100470a44a7db1550fc7989257c35c5ac808d /errors.go
parent698cd6aaf4e4fd235d5af904376c89f8faf177f7 (diff)
downloadgo-schwift-fafac750baa70812432020784cc5ba2cc23224cc.tar.gz
add Container
Diffstat (limited to 'errors.go')
-rw-r--r--errors.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/errors.go b/errors.go
index d4b3470..7a7d40d 100644
--- a/errors.go
+++ b/errors.go
@@ -49,11 +49,14 @@ func (e UnexpectedStatusCodeError) Error() string {
for idx, code := range e.ExpectedStatusCodes {
codeStrs[idx] = strconv.Itoa(code)
}
- return fmt.Sprintf("expected %s response, got %d instead: %s",
+ msg := fmt.Sprintf("expected %s response, got %d instead",
strings.Join(codeStrs, "/"),
e.ActualResponse.StatusCode,
- string(e.ResponseBody),
)
+ if len(e.ResponseBody) > 0 {
+ msg += ": " + string(e.ResponseBody)
+ }
+ return msg
}
//Is checks if the given error is an UnexpectedStatusCodeError for that status