Skip to content

Commit

Permalink
do not crash if key in not in keyring on deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
endorama committed Jul 4, 2018
1 parent 4ea8c2c commit 894818b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,12 @@ func remove(storage Storage, name string) {

err := key.Delete()
if err != nil {
fmt.Printf("%+v\n", err)
log.Fatal(err)
if strings.HasPrefix(err.Error(), "Item not found") {
log.Output(2, "Key is not present in keyring, skipping deletion")
} else {
fmt.Printf("%+v\n", err)
log.Fatal(err)
}
}
err = storage.RemoveKey(name)
if err != nil {
Expand Down

0 comments on commit 894818b

Please sign in to comment.