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

@@ -19,10 +19,15 @@ func (e *ExtractorError) Error() string {
const maxRetryAttempts = 3
func extractorErrorHandler(chErrorsIn <-chan ExtractorError, chBatchesOut chan<- Batch, chGlobalErrorsOut chan<- error) {
func extractorErrorHandler(chErrorsIn <-chan ExtractorError, chBatchesOut chan<- Batch, chJobErrorsOut chan<- JobError) {
for err := range chErrorsIn {
if err.RetryCounter >= maxRetryAttempts {
chGlobalErrorsOut <- fmt.Errorf("batch %v reached max retries (%d): %s", err.Id, maxRetryAttempts, err.Msg)
jobError := JobError{
ShouldCancelJob: false,
Msg: fmt.Sprintf("batch %v reached max retries (%d)", err.Id, maxRetryAttempts),
Prev: &err,
}
chJobErrorsOut <- jobError
continue
}