fix: record last error when calling processDir
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
2afc232eb1
commit
1091eebf4b
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user