feat: enhance error handling with JobError struct and update extractor logic
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user