Skip to content

Commit

Permalink
Merge pull request #1329 from eicca/improve-api-readme
Browse files Browse the repository at this point in the history
Handle error in api README example
  • Loading branch information
ryanbreen committed Oct 23, 2015
2 parents 6a350d5 + 01aba57 commit 1585913
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ Usage
Below is an example of using the Consul client:

```go
// Get a new client, with KV endpoints
client, _ := api.NewClient(api.DefaultConfig())
// Get a new client
client, err := api.NewClient(api.DefaultConfig())
if err != nil {
panic(err)
}

// Get a handle to the KV API
kv := client.KV()

// PUT a new KV pair
p := &api.KVPair{Key: "foo", Value: []byte("test")}
_, err := kv.Put(p, nil)
_, err = kv.Put(p, nil)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 1585913

Please sign in to comment.