aboutsummaryrefslogtreecommitdiff
path: root/errors.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-01-29 21:19:39 +0100
committerStefan Majewsky <majewsky@gmx.net>2018-01-29 21:43:45 +0100
commitcad4a10319b98dd15c0a74d0fea13a2da4a0d3cc (patch)
tree0703764e2d3a94fce3a553720f2a182e57612de2 /errors.go
parent3834e49c90c39f4c95e3b9e7bb52b35204a75625 (diff)
downloadgo-schwift-cad4a10319b98dd15c0a74d0fea13a2da4a0d3cc.tar.gz
lay down the full Account API
Diffstat (limited to 'errors.go')
-rw-r--r--errors.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/errors.go b/errors.go
index 62c5792..d4b3470 100644
--- a/errors.go
+++ b/errors.go
@@ -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()
+}