fix: record last error when calling processDir
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
鲁树人 2024-10-08 22:01:36 +01:00
parent 2afc232eb1
commit 36df203bdd

View File

@ -231,6 +231,8 @@ func (p *processor) processDir(inputDir string) error {
if err != nil { if err != nil {
return err return err
} }
var lastError error = nil
for _, item := range items { for _, item := range items {
if item.IsDir() { if item.IsDir() {
continue continue
@ -238,9 +240,13 @@ func (p *processor) processDir(inputDir string) error {
filePath := filepath.Join(inputDir, item.Name()) filePath := filepath.Join(inputDir, item.Name())
if err := p.processFile(filePath); err != nil { if err := p.processFile(filePath); err != nil {
lastError = err
logger.Error("conversion failed", zap.String("source", item.Name()), zap.Error(err)) logger.Error("conversion failed", zap.String("source", item.Name()), zap.Error(err))
} }
} }
if lastError != nil {
return fmt.Errorf("last error: %w", lastError)
}
return nil return nil
} }