Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 55ab4c8

Browse files
Merge pull request #26 from topcoder-platform/develop
sync master with develop
2 parents afe9bed + 6e9c2d1 commit 55ab4c8

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

src/common/helper.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,26 @@ async function getUser (userId, transactionId) {
153153
*/
154154
async function updateUser (userId, body, seqNo, primaryTerm, transactionId) {
155155
const client = await getESClient()
156-
await client.index({
157-
index: config.get('ES.USER_INDEX'),
158-
type: config.get('ES.USER_TYPE'),
159-
id: userId,
160-
transactionId,
161-
body,
162-
if_seq_no: seqNo,
163-
if_primary_term: primaryTerm,
164-
pipeline: config.get('ES.ENRICHMENT.user.pipelineId'),
165-
refresh: 'wait_for'
166-
})
156+
try {
157+
await client.index({
158+
index: config.get('ES.USER_INDEX'),
159+
type: config.get('ES.USER_TYPE'),
160+
id: userId,
161+
transactionId,
162+
body,
163+
if_seq_no: seqNo,
164+
if_primary_term: primaryTerm,
165+
pipeline: config.get('ES.ENRICHMENT.user.pipelineId'),
166+
refresh: 'wait_for'
167+
})
168+
logger.debug('Update user completed')
169+
} catch (err) {
170+
if (err && err.meta && err.meta.body && err.meta.body.error) {
171+
logger.debug(JSON.stringify(err.meta.body.error, null, 4))
172+
}
173+
logger.debug(JSON.stringify(err))
174+
throw err
175+
}
167176
}
168177

169178
/**

0 commit comments

Comments
 (0)