diff --git a/internal/api/import.go b/internal/api/import.go index cbe5e5749..ff4e3d85e 100644 --- a/internal/api/import.go +++ b/internal/api/import.go @@ -78,7 +78,7 @@ func StartImport(router *gin.RouterGroup) { if subPath != "" && path != conf.ImportPath() && fs.IsEmpty(path) { if err := os.Remove(path); err != nil { - log.Errorf("import: could not delete empty folder %s: %s", txt.Quote(path), err) + log.Errorf("import: failed deleting empty folder %s: %s", txt.Quote(path), err) } else { log.Infof("import: deleted empty folder %s", txt.Quote(path)) } diff --git a/internal/api/zip.go b/internal/api/zip.go index c08965810..03255cf81 100644 --- a/internal/api/zip.go +++ b/internal/api/zip.go @@ -134,7 +134,7 @@ func DownloadZip(router *gin.RouterGroup) { c.File(zipFileName) if err := os.Remove(zipFileName); err != nil { - log.Errorf("zip: could not remove %s (%s)", txt.Quote(zipFileName), err.Error()) + log.Errorf("zip: failed removing %s (%s)", txt.Quote(zipFileName), err.Error()) } }) } diff --git a/internal/photoprism/import.go b/internal/photoprism/import.go index e1107e16f..30e3a0d07 100644 --- a/internal/photoprism/import.go +++ b/internal/photoprism/import.go @@ -183,7 +183,7 @@ func (imp *Import) Start(opt ImportOptions) map[string]bool { for _, directory := range directories { if fs.IsEmpty(directory) { if err := os.Remove(directory); err != nil { - log.Errorf("import: could not delete empty folder %s (%s)", txt.Quote(fs.RelName(directory, importPath)), err) + log.Errorf("import: failed deleting empty folder %s (%s)", txt.Quote(fs.RelName(directory, importPath)), err) } else { log.Infof("import: deleted empty folder %s", txt.Quote(fs.RelName(directory, importPath))) } @@ -199,7 +199,7 @@ func (imp *Import) Start(opt ImportOptions) map[string]bool { } if err := os.Remove(file); err != nil { - log.Errorf("import: could not remove %s (%s)", txt.Quote(fs.RelName(file, importPath)), err.Error()) + log.Errorf("import: failed removing %s (%s)", txt.Quote(fs.RelName(file, importPath)), err.Error()) } } } diff --git a/internal/photoprism/import_worker.go b/internal/photoprism/import_worker.go index 8bb3752c4..a6adcae77 100644 --- a/internal/photoprism/import_worker.go +++ b/internal/photoprism/import_worker.go @@ -45,7 +45,7 @@ func ImportWorker(jobs <-chan ImportJob) { if destinationFilename, err := imp.DestinationFilename(related.Main, f); err == nil { if err := os.MkdirAll(path.Dir(destinationFilename), os.ModePerm); err != nil { - log.Errorf("import: could not create folders (%s)", err.Error()) + log.Errorf("import: failed creating folders for %s (%s)", txt.Quote(f.BaseName()), err.Error()) } if related.Main.HasSameName(f) { @@ -57,11 +57,11 @@ func ImportWorker(jobs <-chan ImportJob) { if opt.Move { if err := f.Move(destinationFilename); err != nil { - log.Errorf("import: could not move file to %s (%s)", txt.Quote(fs.RelName(destinationMainFilename, imp.originalsPath())), err.Error()) + log.Errorf("import: failed moving file to %s (%s)", txt.Quote(fs.RelName(destinationMainFilename, imp.originalsPath())), err.Error()) } } else { if err := f.Copy(destinationFilename); err != nil { - log.Errorf("import: could not copy file to %s (%s)", txt.Quote(fs.RelName(destinationMainFilename, imp.originalsPath())), err.Error()) + log.Errorf("import: failed copying file to %s (%s)", txt.Quote(fs.RelName(destinationMainFilename, imp.originalsPath())), err.Error()) } } } else { @@ -69,7 +69,7 @@ func ImportWorker(jobs <-chan ImportJob) { if opt.RemoveExistingFiles { if err := f.Remove(); err != nil { - log.Errorf("import: could not delete %s (%s)", txt.Quote(fs.RelName(f.FileName(), importPath)), err.Error()) + log.Errorf("import: failed deleting %s (%s)", txt.Quote(f.BaseName()), err.Error()) } else { log.Infof("import: deleted %s (already exists)", txt.Quote(relativeFilename)) } diff --git a/internal/photoprism/index_related.go b/internal/photoprism/index_related.go index 7948aa53e..a997c5376 100644 --- a/internal/photoprism/index_related.go +++ b/internal/photoprism/index_related.go @@ -29,7 +29,7 @@ func IndexMain(related *RelatedFiles, ind *Index, opt IndexOptions) (result Inde if opt.Convert && !f.HasJpeg() { if jpegFile, err := ind.convert.ToJpeg(f); err != nil { - result.Err = fmt.Errorf("index: creating jpeg failed (%s)", err.Error()) + result.Err = fmt.Errorf("index: failed converting %s to jpeg (%s)", txt.Quote(f.BaseName()), err.Error()) result.Status = IndexFailed return result @@ -37,7 +37,7 @@ func IndexMain(related *RelatedFiles, ind *Index, opt IndexOptions) (result Inde log.Infof("index: %s created", fs.RelName(jpegFile.FileName(), ind.originalsPath())) if err := jpegFile.ResampleDefault(ind.thumbPath(), false); err != nil { - result.Err = fmt.Errorf("index: could not create default thumbnails (%s)", err.Error()) + result.Err = fmt.Errorf("index: failed creating thumbnails for %s (%s)", txt.Quote(f.BaseName()), err.Error()) result.Status = IndexFailed return result @@ -49,7 +49,7 @@ func IndexMain(related *RelatedFiles, ind *Index, opt IndexOptions) (result Inde if ind.conf.SidecarJson() && !f.HasJson() { if jsonFile, err := ind.convert.ToJson(f); err != nil { - log.Errorf("index: creating json sidecar file failed (%s)", err.Error()) + log.Errorf("index: failed creating json sidecar for %s (%s)", txt.Quote(f.BaseName()), err.Error()) } else { log.Infof("index: %s created", fs.RelName(jsonFile.FileName(), ind.originalsPath())) } @@ -59,7 +59,7 @@ func IndexMain(related *RelatedFiles, ind *Index, opt IndexOptions) (result Inde if result.Indexed() && f.IsJpeg() { if err := f.ResampleDefault(ind.thumbPath(), false); err != nil { - log.Errorf("index: could not create default thumbnails (%s)", err.Error()) + log.Errorf("index: failed creating thumbnails for %s (%s)", txt.Quote(f.BaseName()), err.Error()) query.SetFileError(result.FileUID, err.Error()) } } @@ -107,7 +107,7 @@ func IndexRelated(related RelatedFiles, ind *Index, opt IndexOptions) (result In if res.Indexed() && f.IsJpeg() { if err := f.ResampleDefault(ind.thumbPath(), false); err != nil { - log.Errorf("index: could not create default thumbnails (%s)", err.Error()) + log.Errorf("index: failed creating thumbnails for %s (%s)", txt.Quote(f.BaseName()), err.Error()) query.SetFileError(res.FileUID, err.Error()) } } diff --git a/internal/photoprism/mediafile.go b/internal/photoprism/mediafile.go index ed9afca62..301cffc48 100644 --- a/internal/photoprism/mediafile.go +++ b/internal/photoprism/mediafile.go @@ -493,7 +493,7 @@ func (m *MediaFile) Move(dest string) error { } if err := os.Rename(m.fileName, dest); err != nil { - log.Debugf("could not rename file, falling back to copy and delete: %s", err.Error()) + log.Debugf("failed renaming file, fallback to copy and delete: %s", err.Error()) } else { m.fileName = dest @@ -802,8 +802,9 @@ func (m *MediaFile) Thumbnail(path string, typeName string) (filename string, er thumbnail, err := thumb.FromFile(m.FileName(), m.Hash(), path, thumbType.Width, thumbType.Height, thumbType.Options...) if err != nil { - log.Errorf("mediafile: could not create thumbnail (%s)", err) - return "", fmt.Errorf("mediafile: could not create thumbnail (%s)", err) + err = fmt.Errorf("mediafile: failed creating thumbnail for %s (%s)", txt.Quote(m.BaseName()), err) + log.Error(err) + return "", err } return thumbnail, nil @@ -850,7 +851,7 @@ func (m *MediaFile) ResampleDefault(thumbPath string, force bool) (err error) { } if fileName, err := thumb.Filename(hash, thumbPath, thumbType.Width, thumbType.Height, thumbType.Options...); err != nil { - log.Errorf("mediafile: could not create %s (%s)", txt.Quote(name), err) + log.Errorf("mediafile: failed creating %s (%s)", txt.Quote(name), err) return err } else { @@ -881,7 +882,7 @@ func (m *MediaFile) ResampleDefault(thumbPath string, force bool) (err error) { } if err != nil { - log.Errorf("mediafile: could not create %s (%s)", txt.Quote(name), err) + log.Errorf("mediafile: failed creating %s (%s)", txt.Quote(name), err) return err } diff --git a/internal/photoprism/mediafile_test.go b/internal/photoprism/mediafile_test.go index 22afdd1d0..d2a8a33e0 100644 --- a/internal/photoprism/mediafile_test.go +++ b/internal/photoprism/mediafile_test.go @@ -1586,7 +1586,7 @@ func TestMediaFile_Thumbnail(t *testing.T) { thumbnail, err := image.Thumbnail(thumbsPath, "tile_500") - assert.EqualError(t, err, "mediafile: could not create thumbnail (image: unknown format)") + assert.EqualError(t, err, "mediafile: failed creating thumbnail for canon_eos_6d.xmp (image: unknown format)") t.Log(thumbnail) }) diff --git a/internal/workers/share.go b/internal/workers/share.go index 31dd85b95..f2592bd4d 100644 --- a/internal/workers/share.go +++ b/internal/workers/share.go @@ -90,7 +90,7 @@ func (worker *Share) Start() (err error) { if _, ok := existingDirs[dir]; !ok { if err := client.CreateDir(dir); err != nil { - log.Errorf("share-worker: could not create folder %s", dir) + log.Errorf("share-worker: failed creating folder %s", dir) continue } } diff --git a/internal/workers/sync_upload.go b/internal/workers/sync_upload.go index 305a00354..5e40d0ea4 100644 --- a/internal/workers/sync_upload.go +++ b/internal/workers/sync_upload.go @@ -44,7 +44,7 @@ func (worker *Sync) upload(a entity.Account) (complete bool, err error) { if _, ok := existingDirs[remoteDir]; !ok { if err := client.CreateDir(remoteDir); err != nil { - log.Errorf("sync-worker: could not create remote folder %s", remoteDir) + log.Errorf("sync-worker: failed creating remote folder %s", remoteDir) continue // try again next time } }