diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-02-04 23:29:09 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-02-04 23:29:09 +0100 |
| commit | fafac750baa70812432020784cc5ba2cc23224cc (patch) | |
| tree | 2b0100470a44a7db1550fc7989257c35c5ac808d /errors.go | |
| parent | 698cd6aaf4e4fd235d5af904376c89f8faf177f7 (diff) | |
| download | go-schwift-fafac750baa70812432020784cc5ba2cc23224cc.tar.gz | |
add Container
Diffstat (limited to 'errors.go')
| -rw-r--r-- | errors.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 |
