Skip to content

Commit

Permalink
fix: throw if job didn't process any record
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 committed Nov 25, 2024
1 parent f6e10b6 commit 7ef8d0e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions messages/bulkIngest.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ Job has been aborted.

You must have the "Bulk API Hard Delete" system permission to use the --hard-delete flag. This permission is disabled by default and can be enabled only by a system administrator.

# error.noProcessedRecords

Job finished successfully but it didn't process any record.

# error.noProcessedRecords.actions

- Check that the provided CSV file is valid.
- View the job in the org: "sf org open -o %s --path '/lightning/setup/AsyncApiJobStatus/page?address=%2F%s'".

# flags.column-delimiter.summary

Column delimiter used in the CSV file.
Expand Down
14 changes: 14 additions & 0 deletions src/bulkIngest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ export async function bulkIngest(opts: {
// send last data update so job status/num. of records processed/failed represent the last update
stages.update(jobInfo);

if (jobInfo.numberRecordsProcessed === 0) {
stages.error();
// remove after W-17099874 gets fixed
// eslint-disable-next-line sf-plugin/no-missing-messages
throw messages.createError('error.noProcessedRecords');
}

if (jobInfo.numberRecordsFailed) {
stages.error();
if (opts.verbose && !opts.jsonEnabled) {
Expand Down Expand Up @@ -256,6 +263,13 @@ export async function bulkIngestResume(opts: {
// send last data update so job status/num. of records processed/failed represent the last update
stages.update(jobInfo);

if (jobInfo.numberRecordsProcessed === 0) {
stages.error();
// remove after W-17099874 gets fixed
// eslint-disable-next-line sf-plugin/no-missing-messages
throw messages.createError('error.noProcessedRecords');
}

if (jobInfo.numberRecordsFailed) {
stages.error();

Expand Down

0 comments on commit 7ef8d0e

Please sign in to comment.