Skip to content

fix(bulk v2): catch job errors while polling#705

Merged
cristiand391 merged 5 commits intomainfrom
cd/catch-bulk-job-error
Oct 20, 2023
Merged

fix(bulk v2): catch job errors while polling#705
cristiand391 merged 5 commits intomainfrom
cd/catch-bulk-job-error

Conversation

@cristiand391
Copy link
Copy Markdown
Member

What does this PR do?

requires jsforce/jsforce#1367

when polling for an ingest job status like await job.poll() jsforce will emit a failure event if the job fails but it doesn't throw so all job errors during polling are swallowed.
This PR adds a handler for the failed event and make data commands throw.

failed event: https://github.com/jsforce/jsforce/blob/8a359d663215081becc63561735b947df759c185/src/api/bulk.ts#L1505

What issues does this PR fix or reference?

@W-13502104@

job.emit('error', err);
}
if (err.message.startsWith('Polling time out')) {
if (err.name === 'PollingTimeout') {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} catch (e) {
const err = e as Error & { jobId: string };
if (timeout.minutes === 0 && err.message.includes('Polling time out')) {
if (timeout.minutes === 0 && err.name === 'JobPollingTimeout') {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cristiand391 cristiand391 merged commit 74a245e into main Oct 20, 2023
@cristiand391 cristiand391 deleted the cd/catch-bulk-job-error branch October 20, 2023 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants