Fix incorrect error message in watch.Until

This commit is contained in:
Janet Kuo 2017-02-07 16:51:35 -08:00
parent 4cef1008f4
commit 51c7570ae1
2 changed files with 4 additions and 1 deletions

View File

@ -129,6 +129,9 @@ func Jitter(duration time.Duration, maxFactor float64) time.Duration {
// ErrWaitTimeout is returned when the condition exited without success.
var ErrWaitTimeout = errors.New("timed out waiting for the condition")
// ErrChannelClosed is returned when the watch channel is closed.
var ErrChannelClosed = errors.New("watch channel closed")
// ConditionFunc returns true if the condition is satisfied, or an error
// if the loop should be aborted.
type ConditionFunc func() (done bool, err error)

View File

@ -61,7 +61,7 @@ func Until(timeout time.Duration, watcher Interface, conditions ...ConditionFunc
select {
case event, ok := <-ch:
if !ok {
return lastEvent, wait.ErrWaitTimeout
return lastEvent, wait.ErrChannelClosed
}
lastEvent = &event