From 0753d87f410da6432f9ab4ab1d35e9b923fb9766 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 7 Feb 2018 23:58:51 +0100 Subject: adjust example for current API --- errors.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'errors.go') diff --git a/errors.go b/errors.go index 7a7d40d..8e3eef6 100644 --- a/errors.go +++ b/errors.go @@ -62,13 +62,15 @@ func (e UnexpectedStatusCodeError) Error() string { //Is checks if the given error is an UnexpectedStatusCodeError for that status //code. For example: // -// info, err := container.Info() -// if schwift.Is(err, http.StatusNotFound) { -// // ... create container ... -// } else if err != nil { -// // ... report error ... -// } else { -// // ... use container info ... +// err := container.Delete(nil, nil) +// if err != nil { +// if schwift.Is(err, http.StatusNotFound) { +// //container does not exist -> just what we wanted +// return nil +// } else { +// //report unexpected error +// return err +// } // } func Is(err error, code int) bool { if e, ok := err.(UnexpectedStatusCodeError); ok { -- cgit v1.2.3