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