diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-01-29 21:19:39 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-01-29 21:43:45 +0100 |
| commit | cad4a10319b98dd15c0a74d0fea13a2da4a0d3cc (patch) | |
| tree | 0703764e2d3a94fce3a553720f2a182e57612de2 /errors.go | |
| parent | 3834e49c90c39f4c95e3b9e7bb52b35204a75625 (diff) | |
| download | go-schwift-cad4a10319b98dd15c0a74d0fea13a2da4a0d3cc.tar.gz | |
lay down the full Account API
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() +} |
