Skip to content

Commit

Permalink
fix: update cli GenerateTumbnails call for multi error return
Browse files Browse the repository at this point in the history
Signed-off-by: Rachel Powers <[email protected]>
  • Loading branch information
Ryex committed Oct 4, 2024
1 parent 2125819 commit 1e6b1e4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ func (gtc *GenTumbCmd) Run(ctx *Context) error {
return err
}

errs := pkg.BuildFileList()
var errs []error
errs = pkg.BuildFileList()
if len(errs) != 0 {
for _, err := range errs {
l.WithField("task", "build file list").Errorf("error: %s", err.Error())
Expand All @@ -121,15 +122,15 @@ func (gtc *GenTumbCmd) Run(ctx *Context) error {
return info.IsTexture()
})))
bar := progressbar.Default(total, "Generating Thumbnails ...")
err = pkg.GenerateThumbnailsProgress(func(p float64) {
errs = pkg.GenerateThumbnailsProgress(func(p float64) {
bar.Set(int(p * float64(total)))
})
} else {
err = pkg.GenerateThumbnails()
errs = pkg.GenerateThumbnails()
}
if err != nil {
l.WithError(err).Error("error generating thumbnails")
return err
if len(errs) != 0 {
l.Error("error generating thumbnails")
return errors.Join(errs...)
}

return nil
Expand Down

0 comments on commit 1e6b1e4

Please sign in to comment.