Skip to content

Commit

Permalink
Skip unuseful error message in dev mode when watching local filesystem (
Browse files Browse the repository at this point in the history
go-gitea#25919)

Before, in dev mode, there might be some error logs like:

```
2023/07/17 13:54:51 ...s/assetfs/layered.go:221:WatchLocalChanges() [E] Unable to watch directory .: lstat /data/work/gitea/custom/templates: no such file or directory

```

Because there is no "custom/templates" directory.

After: ignore such error, no such error message anymore.
  • Loading branch information
wxiaoguang authored and GiteaBot committed Jul 17, 2023
1 parent 6e82d0b commit 312261f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/assetfs/layered.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (l *LayeredFS) WatchLocalChanges(ctx context.Context, callback func()) {
}
layerDirs = append(layerDirs, ".")
for _, dir := range layerDirs {
if err = watcher.Add(util.FilePathJoinAbs(layer.localPath, dir)); err != nil {
if err = watcher.Add(util.FilePathJoinAbs(layer.localPath, dir)); err != nil && !os.IsNotExist(err) {
log.Error("Unable to watch directory %s: %v", dir, err)
}
}
Expand Down

0 comments on commit 312261f

Please sign in to comment.