diff --git a/cmd/um/main.go b/cmd/um/main.go index 8f1f485..5d0c41f 100644 --- a/cmd/um/main.go +++ b/cmd/um/main.go @@ -143,6 +143,7 @@ func appMain(c *cli.Context) (err error) { } proc := &processor{ + errorCount: 0, outputDir: output, skipNoopDecoder: c.Bool("skip-noop"), removeSource: c.Bool("remove-source"), @@ -170,6 +171,7 @@ type processor struct { removeSource bool updateMetadata bool overwriteOutput bool + errorCount int } func (p *processor) watchDir(inputDir string) error { @@ -231,6 +233,8 @@ func (p *processor) processDir(inputDir string) error { if err != nil { return err } + + var lastError error = nil for _, item := range items { if item.IsDir() { continue @@ -238,10 +242,11 @@ func (p *processor) processDir(inputDir string) error { filePath := filepath.Join(inputDir, item.Name()) if err := p.processFile(filePath); err != nil { + lastError = err logger.Error("conversion failed", zap.String("source", item.Name()), zap.Error(err)) } } - return nil + return lastError } func (p *processor) processFile(filePath string) error {