aboutsummaryrefslogtreecommitdiff
path: root/errors.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-02-07 23:58:51 +0100
committerStefan Majewsky <majewsky@gmx.net>2018-02-07 23:59:52 +0100
commit0753d87f410da6432f9ab4ab1d35e9b923fb9766 (patch)
tree247af365e6a0b67952c3bd641d1c39a718ab6309 /errors.go
parenta4f40bee33f2c8094d2e0315c89ded2d6b0ba95d (diff)
downloadgo-schwift-0753d87f410da6432f9ab4ab1d35e9b923fb9766.tar.gz
adjust example for current API
Diffstat (limited to 'errors.go')
-rw-r--r--errors.go16
1 files changed, 9 insertions, 7 deletions
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 {