Skip to content

Commit

Permalink
[#1097] Add return promise reject in syncFormSubmission
Browse files Browse the repository at this point in the history
  • Loading branch information
ifirmawan committed Jan 30, 2024
1 parent bb2dc65 commit 02ab0d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/src/lib/background-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,16 @@ const syncFormSubmission = async (activeJob = {}) => {
await crudJobs.deleteJob(activeJob.id);
}
return res;
} catch (err) {
} catch (error) {
const { status: errorCode } = error?.response;
if (activeJob?.id) {
const updatePayload =
activeJob.attempt < MAX_ATTEMPT
? { status: jobStatus.FAILED, attempt: activeJob.attempt + 1 }
: { status: jobStatus.ON_PROGRESS, info: String(err) };
crudJobs.updateJob(activeJob.id, updatePayload);
}
console.error('[syncFormSubmission] Error: ', err);
return Promise.reject({ errorCode, message: error?.message });
}
};

Expand Down

0 comments on commit 02ab0d5

Please sign in to comment.