From 9b42ef5d46afa9d8cfa253bdd8eff6a286b6d194 Mon Sep 17 00:00:00 2001 From: Oleg Butuzov Date: Sun, 18 Apr 2021 13:52:55 +0300 Subject: [PATCH] "file does not exist" improving for watchers Adds additional (initial missing) context to the go generic `os.ErrNotExist` error, in addition to other errors that (possibly) can be returned by `zglob.Glob` Closes #472 --- watch.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/watch.go b/watch.go index 9fcf80f4..15f56871 100644 --- a/watch.go +++ b/watch.go @@ -2,6 +2,7 @@ package task import ( "context" + "fmt" "os" "os/signal" "path/filepath" @@ -129,7 +130,7 @@ func (e *Executor) registerWatchedFiles(w *watcher.Watcher, calls ...taskfile.Ca for _, s := range task.Sources { files, err := zglob.Glob(s) if err != nil { - return err + return fmt.Errorf("task: %s: %w", s, err) } for _, f := range files { absFile, err := filepath.Abs(f)