SQLite: Improve logging to confirm where the error is triggered #3742

see also https://github.com/photoprism/photoprism/discussions/3665

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-09-19 09:12:15 +02:00
parent 09e09f4d23
commit 139562e393
4 changed files with 6 additions and 5 deletions

View file

@ -63,11 +63,11 @@ func BatchPhotosArchive(router *gin.RouterGroup) {
}
}
} else if err := entity.Db().Where("photo_uid IN (?)", f.Photos).Delete(&entity.Photo{}).Error; err != nil {
log.Errorf("archive: %s", err)
log.Errorf("archive: failed to archive %d pictures (%s)", len(f.Photos), err)
AbortSaveFailed(c)
return
} else if err := entity.Db().Model(&entity.PhotoAlbum{}).Where("photo_uid IN (?)", f.Photos).UpdateColumn("hidden", true).Error; err != nil {
log.Errorf("archive: %s", err)
} else if err = entity.Db().Model(&entity.PhotoAlbum{}).Where("photo_uid IN (?)", f.Photos).UpdateColumn("hidden", true).Error; err != nil {
log.Errorf("archive: failed to flag %d pictures as hidden (%s)", len(f.Photos), err)
}
// Update precalculated photo and file counts.

View file

@ -78,7 +78,7 @@ func AlbumCover(router *gin.RouterGroup) {
f, err := query.AlbumCoverByUID(uid, conf.Settings().Features.Private)
if err != nil {
log.Debugf("%s: %s contains no photos, using generic cover", albumCover, uid)
log.Debugf("%s: %s contains no pictures, using generic cover", albumCover, uid)
c.Data(http.StatusOK, "image/svg+xml", albumIconSvg)
return
}

View file

@ -87,7 +87,7 @@ func FolderCover(router *gin.RouterGroup) {
f, err := query.FolderCoverByUID(uid)
if err != nil {
log.Debugf("%s: %s contains no photos, using generic cover", folderCover, uid)
log.Debugf("%s: %s contains no pictures, using generic cover", folderCover, uid)
c.Data(http.StatusOK, "image/svg+xml", folderIconSvg)
return
}

View file

@ -194,6 +194,7 @@ func FlagHiddenPhotos() (err error) {
// Nothing to do.
return nil
} else if err = Db().Table(entity.Photo{}.TableName()).Where("id IN (?)", hidden).UpdateColumn("photo_quality", -1).Error; err != nil {
log.Warnf("index: failed to flag %d pictures as hidden", len(hidden))
// Update failed.
return err
} else {