Skip to content

Commit

Permalink
Update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-joshi99 committed Nov 29, 2023
1 parent e9f2370 commit ad48899
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,6 @@ describe('Upsert Profile Batch', () => {
events,
useDefaultMappings: true
})
).rejects.toThrow('An error occurred while processing the request')
).rejects.toThrow()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -203,20 +203,15 @@ const action: ActionDefinition<Settings, Payload> = {
let importResponseWithList
let importResponseWithoutList

try {
if (profilesWithList.length > 0) {
const listId = profilesWithList[0].list_id
const importJobPayload = createImportJobPayload(profilesWithList, listId)
importResponseWithList = await sendImportJobRequest(request, importJobPayload)
}
if (profilesWithList.length > 0) {
const listId = profilesWithList[0].list_id
const importJobPayload = createImportJobPayload(profilesWithList, listId)
importResponseWithList = await sendImportJobRequest(request, importJobPayload)
}

if (profilesWithoutList.length > 0) {
const importJobPayload = createImportJobPayload(profilesWithoutList)
importResponseWithoutList = await sendImportJobRequest(request, importJobPayload)
}
} catch (error) {
console.error('Error processing batch:', error)
throw new Error('An error occurred while processing the request')
if (profilesWithoutList.length > 0) {
const importJobPayload = createImportJobPayload(profilesWithoutList)
importResponseWithoutList = await sendImportJobRequest(request, importJobPayload)
}

return {
Expand Down

0 comments on commit ad48899

Please sign in to comment.