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

@@ -23,20 +23,18 @@ func extractFromMssql(
chBatchesIn <-chan Batch,
chChunksOut chan<- []UnknownRowValues,
chErrorsOut chan<- ExtractorError,
chJobErrorsOut chan<- JobError,
) {
indexPrimaryKey := slices.IndexFunc(columns, func(col ColumnType) bool {
return strings.EqualFold(col.name, job.PrimaryKey)
})
if indexPrimaryKey == -1 {
exError := ExtractorError{
Batch: Batch{
RetryCounter: maxRetryAttempts,
},
HasLastId: false,
Msg: "Primary key not found in columns provided",
exError := JobError{
ShouldCancelJob: true,
Msg: "Primary key not found in provided columns",
}
chErrorsOut <- exError
chJobErrorsOut <- exError
return
}
@@ -91,6 +89,7 @@ func extractFromMssql(
}
lastRow := rowsChunk[len(rowsChunk)-1]
chChunksOut <- rowsChunk
chErrorsOut <- ExtractorErrorFromLastRowMssql(lastRow, indexPrimaryKey, &batch, err)
return
}