Skip to content

Commit

Permalink
Fixing most unexpected error messages during dehydration process
Browse files Browse the repository at this point in the history
  • Loading branch information
boggydigital committed Dec 17, 2024
1 parent 1957f6d commit 72b3d8a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cli/dehydrate_posters.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import (
"os"
)

var (
ErrVideoHasNoPosterThumbnail = errors.New("video has no poster thumbnails")
)

func DehydratePostersHandler(u *url.URL) error {
force := u.Query().Has("force")
return DehydratePosters(force)
Expand Down Expand Up @@ -48,6 +52,8 @@ func DehydratePosters(force bool) error {
if dp, rc, err := dehydratePosterImageRepColor(videoId); err == nil {
dehydratedPosters[videoId] = append(dehydratedPosters[videoId], dp)
dehydratedRepColors[videoId] = append(dehydratedRepColors[videoId], rc)
} else if errors.Is(err, ErrVideoHasNoPosterThumbnail) {
// do nothing
} else {
dpa.Error(err)
}
Expand Down Expand Up @@ -80,10 +86,11 @@ func dehydratePosterImageRepColor(videoId string) (string, string, error) {
if _, err := os.Stat(absPosterPath); err == nil {
break
}
absPosterPath = ""
}

if absPosterPath == "" {
return "", "", errors.New("video has no poster thumbnails: " + videoId)
return "", "", ErrVideoHasNoPosterThumbnail
}

return issa.DehydrateImageRepColor(absPosterPath)
Expand Down

0 comments on commit 72b3d8a

Please sign in to comment.