fix: pass through to next thumbnail generator on decoder failure (#13)

vips/ffmpeg/libreoffice returning a non-zero exit used to abort the
whole thumbnail pipeline, so files like psd or html never reached a
generator that could handle them. Wrap invoke errors in ErrPassThrough
so later generators get a chance.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
pull/3582/head
Tomas Dvorak 2 weeks ago
parent f3fa77f318
commit d997a1da98

@ -94,7 +94,7 @@ func (f *FfmpegGenerator) Generate(ctx context.Context, es entitysource.EntitySo
if err := cmd.Run(); err != nil {
f.l.Warning("Failed to invoke ffmpeg: %s", stdErr.String())
return &Result{Path: tempOutputPath}, fmt.Errorf("failed to invoke ffmpeg: %w, raw output: %s", err, stdErr.String())
return &Result{Path: tempOutputPath}, fmt.Errorf("failed to invoke ffmpeg: %w, raw output: %s: %w", err, stdErr.String(), ErrPassThrough)
}
return &Result{Path: tempOutputPath}, nil

@ -79,7 +79,7 @@ func (l *LibreOfficeGenerator) Generate(ctx context.Context, es entitysource.Ent
if err := cmd.Run(); err != nil {
l.l.Warning("Failed to invoke LibreOffice: %s", stdErr.String())
return &Result{Path: tempOutputPath}, fmt.Errorf("failed to invoke LibreOffice: %w, raw output: %s", err, stdErr.String())
return &Result{Path: tempOutputPath}, fmt.Errorf("failed to invoke LibreOffice: %w, raw output: %s: %w", err, stdErr.String(), ErrPassThrough)
}
return &Result{

@ -105,7 +105,10 @@ func (v *VipsGenerator) Generate(ctx context.Context, es entitysource.EntitySour
if err := cmd.Run(); err != nil {
v.l.Warning("Failed to invoke vips: %s", vipsErr.String())
return &Result{Path: tempPath}, fmt.Errorf("failed to invoke vips: %w, raw output: %s", err, vipsErr.String())
// A non-zero exit usually means vips cannot decode the format (e.g.
// psd, html). Pass through so later generators can try instead of
// failing the whole pipeline.
return &Result{Path: tempPath}, fmt.Errorf("failed to invoke vips: %w, raw output: %s: %w", err, vipsErr.String(), ErrPassThrough)
}
return &Result{Path: tempPath}, nil

Loading…
Cancel
Save