fix: enhance error handling in extractor and loader processes; ensure proper job error propagation and logging

This commit is contained in:
2026-04-12 20:11:19 -05:00
parent 01780b4b02
commit 5633dc98d0
5 changed files with 46 additions and 14 deletions

View File

@@ -247,24 +247,28 @@ func (mssqlEx *MssqlExtractor) Exec(
if err != nil {
var exError *custom_errors.ExtractorError
var jobError *custom_errors.JobError
if errors.As(err, &exError) {
select {
case <-ctx.Done():
return
case chErrorsOut <- *exError:
}
}
var jobError *custom_errors.JobError
if errors.As(err, &jobError) {
} else if errors.As(err, &jobError) {
select {
case <-ctx.Done():
return
case chJobErrorsOut <- *jobError:
}
} else {
select {
case <-ctx.Done():
return
case chErrorsOut <- custom_errors.ExtractorError{Partition: partition, Msg: err.Error()}:
}
}
return
continue
}
wgActivePartitions.Done()

View File

@@ -97,24 +97,28 @@ func (postgresLd *PostgresLoader) Exec(
if err != nil {
var ldError *custom_errors.LoaderError
var jobError *custom_errors.JobError
if errors.As(err, &ldError) {
select {
case <-ctx.Done():
return
case chErrorsOut <- *ldError:
}
}
var jobError *custom_errors.JobError
if errors.As(err, &jobError) {
} else if errors.As(err, &jobError) {
select {
case <-ctx.Done():
return
case chJobErrorsOut <- *jobError:
}
} else {
select {
case <-ctx.Done():
return
case chErrorsOut <- custom_errors.LoaderError{Batch: batch, Msg: err.Error()}:
}
}
return
continue
}
wgActiveBatches.Done()