Skip to content

Commit 19a487d

Browse files
committed
fix: add catch for partiallyUpdateWorkPeriod
1 parent d3b6040 commit 19a487d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/services/SurveyService.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,27 @@ async function sendSurveys () {
111111
await sendSurveyAPI(collector.collectorId, collector.messageId)
112112
} catch (e) {
113113
for (const contactId in contactIdToWorkPeriodIdMap[collectorName]) {
114-
await partiallyUpdateWorkPeriod(currentUser, contactIdToWorkPeriodIdMap[collectorName][contactId], { sentSurveyError: e })
114+
try {
115+
await partiallyUpdateWorkPeriod(currentUser, contactIdToWorkPeriodIdMap[collectorName][contactId], { sentSurveyError: e })
116+
} catch (e) {
117+
logger.error({ component: 'SurveyService', context: 'sendSurvey', message: 'Error : ' + e.message })
118+
}
115119
}
116120
continue
117121
}
118122
for (const contactId in contactIdToWorkPeriodIdMap[collectorName]) {
119-
await partiallyUpdateWorkPeriod(currentUser, contactIdToWorkPeriodIdMap[collectorName][contactId], { sentSurvey: true })
123+
try {
124+
await partiallyUpdateWorkPeriod(currentUser, contactIdToWorkPeriodIdMap[collectorName][contactId], { sentSurvey: true })
125+
} catch (e) {
126+
logger.error({ component: 'SurveyService', context: 'sendSurvey', message: 'Error : ' + e.message })
127+
}
120128
}
121129
}
122130
}
123131

124132
logger.info({ component: 'SurveyService', context: 'sendSurvey', message: 'send survey successfullly' })
125133
} catch (e) {
126134
logger.error({ component: 'SurveyService', context: 'sendSurvey', message: 'Error : ' + e.message })
127-
throw e
128135
}
129136
}
130137

0 commit comments

Comments
 (0)