Created
February 23, 2014 01:38
-
-
Save jcoene/9165374 to your computer and use it in GitHub Desktop.
riakpbc panic test case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/mrb/riakpbc" | |
) | |
func main() { | |
var err error | |
riak := riakpbc.NewClient([]string{"127.0.0.1:8087"}) | |
if err = riak.Dial(); err != nil { | |
log.Fatalf(err.Error()) | |
} | |
log.Printf("Stop riak and press enter... I'll wait here.") | |
fmt.Scanf("\n") | |
log.Printf("Do we panic?") | |
_, err = riak.FetchObject("not_a_bucket", "not_a_key") | |
switch err { | |
case riakpbc.ErrObjectNotFound: | |
log.Fatalf("Riak wasn't stopped, try agian.") | |
case nil: | |
log.Fatalf("Really? not_a_bucket/not_a_key exists? ;-(") | |
default: | |
log.Fatalf("Some other error occured: %s", err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment