diff options
Diffstat (limited to 'errors.go')
| -rw-r--r-- | errors.go | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -59,13 +59,13 @@ func (e UnexpectedStatusCodeError) Error() string { //Is checks if the given error is an UnexpectedStatusCodeError for that status //code. For example: // -// metadata, err := container.Metadata() +// info, err := container.Info() // if schwift.Is(err, http.StatusNotFound) { // // ... create container ... // } else if err != nil { // // ... report error ... // } else { -// // ... use metadata ... +// // ... use container info ... // } func Is(err error, code int) bool { if e, ok := err.(UnexpectedStatusCodeError); ok { @@ -73,3 +73,15 @@ func Is(err error, code int) bool { } return false } + +//MalformedHeaderError is generated when a response from Swift contains a +//malformed header. +type MalformedHeaderError struct { + Key string + ParseError error +} + +//Error implements the builtin/error interface. +func (e MalformedHeaderError) Error() string { + return "Bad header " + e.Key + ": " + e.ParseError.Error() +} |
