Skip to content

Commit

Permalink
MWPW-158777 returning proper response in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
npeltier committed Sep 19, 2024
1 parent 647f799 commit 244557e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions libs/martech/martech.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,25 @@ export const getTargetPersonalization = async () => {
window.lana.log(`target response time: ${responseTime}`, { tags: 'martech', errorType: 'i' });
}, { once: true });

let manifests = [];
let propositions = [];
let targetManifests = [];
let targetPropositions = [];
const response = await waitForEventOrTimeout(ALLOY_SEND_EVENT, timeout);
if (response.error) {
window.lana.log('target response time: ad blocker', { tags: 'martech', errorType: 'i' });
return [];
return { targetManifests, targetPropositions };
}
if (response.timeout) {
waitForEventOrTimeout(ALLOY_SEND_EVENT, 5100 - timeout)
.then(() => sendTargetResponseAnalytics(true, responseStart, timeout));
} else {
sendTargetResponseAnalytics(false, responseStart, timeout);
manifests = handleAlloyResponse(response.result);
propositions = response.result?.propositions || [];
targetManifests = handleAlloyResponse(response.result);
targetPropositions = response.result?.propositions || [];
}

return {
targetManifests: manifests,
targetPropositions: propositions,
targetManifests,
targetPropositions,
};
};

Expand Down

0 comments on commit 244557e

Please sign in to comment.