diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-02-07 23:58:51 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-02-07 23:59:52 +0100 |
| commit | 0753d87f410da6432f9ab4ab1d35e9b923fb9766 (patch) | |
| tree | 247af365e6a0b67952c3bd641d1c39a718ab6309 /errors.go | |
| parent | a4f40bee33f2c8094d2e0315c89ded2d6b0ba95d (diff) | |
| download | go-schwift-0753d87f410da6432f9ab4ab1d35e9b923fb9766.tar.gz | |
adjust example for current API
Diffstat (limited to 'errors.go')
| -rw-r--r-- | errors.go | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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 { |
