Index: Improve log messages #1010

This commit is contained in:
Michael Mayer 2021-02-08 08:09:23 +01:00
parent 568685f991
commit b09edde419
3 changed files with 5 additions and 5 deletions

View file

@ -69,7 +69,7 @@ func PhotoUnstack(router *gin.RouterGroup) {
stackPrimary, err := stackPhoto.PrimaryFile()
if err != nil {
log.Errorf("photo: can't find primary file for existing photo (unstack %s)", txt.Quote(baseName))
log.Errorf("photo: can't find primary file for %s (unstack)", txt.Quote(baseName))
AbortUnexpected(c)
return
}
@ -81,11 +81,11 @@ func PhotoUnstack(router *gin.RouterGroup) {
AbortEntityNotFound(c)
return
} else if related.Len() == 0 {
log.Errorf("photo: no files found (unstack %s)", txt.Quote(baseName))
log.Errorf("photo: no files found for %s (unstack)", txt.Quote(baseName))
AbortEntityNotFound(c)
return
} else if related.Main == nil {
log.Errorf("photo: no main file found (unstack %s)", txt.Quote(baseName))
log.Errorf("photo: no main file found for %s (unstack)", txt.Quote(baseName))
AbortEntityNotFound(c)
return
}

View file

@ -1173,7 +1173,7 @@ func (m *Photo) SetPrimary(fileUID string) error {
Pluck("file_uid", &files).Error; err != nil {
return err
} else if len(files) == 0 {
return fmt.Errorf("photo %s has no jpegs", m.PhotoUID)
return fmt.Errorf("%s has no primary file", m.PhotoUID)
} else {
fileUID = files[0]
}

View file

@ -114,7 +114,7 @@ func SetPhotoPrimary(photoUID, fileUID string) error {
} else if err := Db().Model(entity.File{}).Where("photo_uid = ? AND file_missing = 0 AND file_type = 'jpg'", photoUID).Order("file_width DESC").Limit(1).Pluck("file_uid", &files).Error; err != nil {
return err
} else if len(files) == 0 {
return fmt.Errorf("can't find primary for %s", photoUID)
return fmt.Errorf("can't find primary file for %s", photoUID)
} else {
fileUID = files[0]
}