feat: enhance error handling with JobError struct and update extractor logic

This commit is contained in:
2026-04-08 20:21:58 -05:00
parent bc6f9a6a70
commit e158986947
4 changed files with 65 additions and 20 deletions

View File

@@ -0,0 +1,33 @@
package main
import (
"fmt"
log "github.com/sirupsen/logrus"
)
type JobError struct {
ShouldCancelJob bool
Msg string
Prev error
}
func (e *JobError) Error() string {
if e.Prev != nil {
return fmt.Sprintf("%s: %v", e.Msg, e.Prev)
}
return e.Msg
}
func jobErrorHandler(chErrorsIn <-chan JobError) error {
for err := range chErrorsIn {
if err.ShouldCancelJob {
return &err
}
log.Error(err)
}
return nil
}