Skip to content

Commit

Permalink
handle error on setBucketValue
Browse files Browse the repository at this point in the history
  • Loading branch information
bcambl committed Feb 21, 2021
1 parent 0e4ed7c commit fd51d9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controllers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ func (c *Controller) IndexHandler(w http.ResponseWriter, r *http.Request) {
}

func (c *Controller) setBucketValue(bucket, key, value string) error {
c.DB.Update(func(tx *bolt.Tx) error {
err := c.DB.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(bucket))
err := b.Put([]byte(key), []byte(value))
return err
})
if err != nil {
return err
}
return nil
}

Expand Down

0 comments on commit fd51d9a

Please sign in to comment.