diff --git a/internal/entity/photo.go b/internal/entity/photo.go index 414fb560c..7bd27d050 100644 --- a/internal/entity/photo.go +++ b/internal/entity/photo.go @@ -875,7 +875,7 @@ func (m *Photo) SetPrimary(fileUID string) (err error) { Pluck("file_uid", &files).Error; err != nil { return err } else if len(files) == 0 { - return fmt.Errorf("found no valid jpeg for %s", m.PhotoUID) + return fmt.Errorf("found no jpeg for photo uid %s", clean.Log(m.PhotoUID)) } else { fileUID = files[0] } diff --git a/internal/photoprism/convert.go b/internal/photoprism/convert.go index 1ca1f6f56..e54e4c3ed 100644 --- a/internal/photoprism/convert.go +++ b/internal/photoprism/convert.go @@ -5,7 +5,6 @@ import ( "fmt" "path/filepath" "runtime/debug" - "strings" "sync" "github.com/karrick/godirwalk" @@ -76,7 +75,6 @@ func (c *Convert) Start(path string, force bool) (err error) { err = godirwalk.Walk(path, &godirwalk.Options{ ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction { - log.Errorf("convert: %s", strings.Replace(err.Error(), path, "", 1)) return godirwalk.SkipNode }, Callback: func(fileName string, info *godirwalk.Dirent) error { @@ -87,7 +85,7 @@ func (c *Convert) Start(path string, force bool) (err error) { }() if mutex.MainWorker.Canceled() { - return errors.New("convert: canceled") + return errors.New("canceled") } isDir := info.IsDir() diff --git a/internal/photoprism/import.go b/internal/photoprism/import.go index 8db0e00f7..48eb377c0 100644 --- a/internal/photoprism/import.go +++ b/internal/photoprism/import.go @@ -8,7 +8,6 @@ import ( "runtime" "runtime/debug" "sort" - "strings" "sync" "github.com/photoprism/photoprism/pkg/media" @@ -118,7 +117,6 @@ func (imp *Import) Start(opt ImportOptions) fs.Done { err := godirwalk.Walk(importPath, &godirwalk.Options{ ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction { - log.Errorf("import: %s", strings.Replace(err.Error(), importPath, "", 1)) return godirwalk.SkipNode }, Callback: func(fileName string, info *godirwalk.Dirent) error { @@ -129,7 +127,7 @@ func (imp *Import) Start(opt ImportOptions) fs.Done { }() if mutex.MainWorker.Canceled() { - return errors.New("import canceled") + return errors.New("canceled") } isDir := info.IsDir() diff --git a/internal/photoprism/index.go b/internal/photoprism/index.go index 758e1bfc6..735c558f3 100644 --- a/internal/photoprism/index.go +++ b/internal/photoprism/index.go @@ -6,7 +6,6 @@ import ( "path/filepath" "runtime" "runtime/debug" - "strings" "sync" "github.com/photoprism/photoprism/pkg/media" @@ -141,12 +140,17 @@ func (ind *Index) Start(o IndexOptions) fs.Done { err := godirwalk.Walk(optionsPath, &godirwalk.Options{ ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction { - log.Errorf("index: %s", strings.Replace(err.Error(), originalsPath, "", 1)) return godirwalk.SkipNode }, Callback: func(fileName string, info *godirwalk.Dirent) error { + defer func() { + if r := recover(); r != nil { + log.Errorf("index: %s (panic)\nstack: %s", r, debug.Stack()) + } + }() + if mutex.MainWorker.Canceled() { - return errors.New("indexing canceled") + return errors.New("canceled") } isDir := info.IsDir() diff --git a/internal/photoprism/resample.go b/internal/photoprism/resample.go index f4533a778..a2c241298 100644 --- a/internal/photoprism/resample.go +++ b/internal/photoprism/resample.go @@ -5,7 +5,6 @@ import ( "fmt" "path/filepath" "runtime/debug" - "strings" "sync" "github.com/karrick/godirwalk" @@ -69,7 +68,6 @@ func (w *Resample) Start(force bool) (err error) { err = godirwalk.Walk(originalsPath, &godirwalk.Options{ ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction { - log.Errorf("resample: %s", strings.Replace(err.Error(), originalsPath, "", 1)) return godirwalk.SkipNode }, Callback: func(fileName string, info *godirwalk.Dirent) error { @@ -80,7 +78,7 @@ func (w *Resample) Start(force bool) (err error) { }() if mutex.MainWorker.Canceled() { - return errors.New("resample: canceled") + return errors.New("canceled") } isDir := info.IsDir() diff --git a/internal/query/photo.go b/internal/query/photo.go index d8f30a5aa..623d6e233 100644 --- a/internal/query/photo.go +++ b/internal/query/photo.go @@ -151,7 +151,7 @@ func FixPrimaries() error { log.Debugf("index: searching primary file for %s", p.PhotoUID) if err := p.SetPrimary(""); err != nil { - log.Infof("index: %s (set primary)", err) + log.Infof("index: %s", err) } }