Source watcher ErrStoppedWatcher and fixed test

This commit is contained in:
Milos Gajdos
2019-08-20 22:32:47 +01:00
parent dfbd730b8c
commit 4ea27517b5
7 changed files with 37 additions and 19 deletions

View File

@@ -3,7 +3,6 @@
package file
import (
"errors"
"os"
"github.com/fsnotify/fsnotify"
@@ -36,7 +35,7 @@ func (w *watcher) Next() (*source.ChangeSet, error) {
// is it closed?
select {
case <-w.exit:
return nil, errors.New("watcher stopped")
return nil, source.ErrWatcherStopped
default:
}
@@ -59,7 +58,7 @@ func (w *watcher) Next() (*source.ChangeSet, error) {
case err := <-w.fw.Errors:
return nil, err
case <-w.exit:
return nil, errors.New("watcher stopped")
return nil, source.ErrWatcherStopped
}
}

View File

@@ -3,7 +3,6 @@
package file
import (
"errors"
"os"
"github.com/fsnotify/fsnotify"
@@ -36,7 +35,7 @@ func (w *watcher) Next() (*source.ChangeSet, error) {
// is it closed?
select {
case <-w.exit:
return nil, errors.New("watcher stopped")
return nil, source.ErrWatcherStopped
default:
}
@@ -63,7 +62,7 @@ func (w *watcher) Next() (*source.ChangeSet, error) {
case err := <-w.fw.Errors:
return nil, err
case <-w.exit:
return nil, errors.New("watcher stopped")
return nil, source.ErrWatcherStopped
}
}