Skip to content

Commit 70d5d80

Browse files
committed
feat: error handling for skippedSourceRecordsFilterWarning
1 parent 9f6c8fe commit 70d5d80

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

messages/resources.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
"writingToFile": "{%s} Creating the file %s ...",
192192
"nothingUpdated": "Nothing was updated.",
193193
"skippedUpdatesWarning": "{%s} %s target records remained untouched, since they do not differ from the corresponding source records.",
194-
"skippedsSourceRecordsFilterWarning": "One 'sourceRecordsFilter' could not be applied: %s.",
194+
"skippedSourceRecordsFilterWarning": "One 'sourceRecordsFilter' could not be applied: %s.",
195195
"skippedTargetRecordsFilterWarning": "One 'targetRecordsFilter' could not be applied: %s.",
196196
"missingParentLookupsPrompt": "{%s} %s missing parent lookup records were found. See %s file for the details.",
197197
"updatingSummary": "Data processing summary.",

src/modules/models/job_models/migrationJobTask.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,12 @@ export default class MigrationJobTask {
639639
___filterTargetQuery(tempQuery);
640640
} else if (this.scriptObject.sourceRecordsFilter) {
641641
// Add any extra filter conditions to the source query
642-
const additionalWhereClause = parseQuery(`SELECT Id FROM ${this.sObjectName} WHERE ${this.scriptObject.sourceRecordsFilter}`).where;
643-
tempQuery.where = Common.mergeWhereClauses(tempQuery.where, additionalWhereClause);
642+
try {
643+
const additionalWhereClause = parseQuery(`SELECT Id FROM ${this.sObjectName} WHERE ${this.scriptObject.sourceRecordsFilter}`).where;
644+
tempQuery.where = Common.mergeWhereClauses(tempQuery.where, additionalWhereClause);
645+
} catch (ex) {
646+
self.logger.warn(RESOURCES.skippedSourceRecordsFilterWarning, ex.message);
647+
}
644648
}
645649

646650
let query = composeQuery(tempQuery);

0 commit comments

Comments
 (0)