Skip to content

Commit

Permalink
Capture and return errors during watches on consul
Browse files Browse the repository at this point in the history
Before this change consul errors were not returned correctly
during watches. Resolved the issue by returning the initial
watch index and error and avoid the nil pointer dereference.

Fixes #322
  • Loading branch information
kelseyhightower committed Feb 19, 2016
1 parent 7afb8d6 commit 5361533
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backends/consul/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func (c *ConsulClient) WatchPrefix(prefix string, waitIndex uint64, stopChan cha
WaitIndex: waitIndex,
}
_, meta, err := c.client.List(prefix, &opts)
if err != nil {
respChan <- watchResponse{waitIndex, err}
return
}
respChan <- watchResponse{meta.LastIndex, err}
}()
for {
Expand Down

0 comments on commit 5361533

Please sign in to comment.