From cad4a10319b98dd15c0a74d0fea13a2da4a0d3cc Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Mon, 29 Jan 2018 21:19:39 +0100 Subject: lay down the full Account API --- errors.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'errors.go') 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() +} -- cgit v1.2.3