Skip to content

Commit

Permalink
Log the response status for the bakers error (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
wi101 authored Jan 16, 2023
1 parent 34c85a2 commit 9481364
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/pixel/sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export function PixelSender (liveConnectConfig, calls, eventBus, onload, presend
_sendState(state, 'j', uri => {
calls.ajaxGet(
uri,
bakersJson => {
(bakersJson, xhr) => {
if (isFunction(onload)) onload()
_callBakers(bakersJson)
_callBakers(bakersJson, xhr)
},
(e) => {
_sendPixel(state)
Expand All @@ -35,14 +35,14 @@ export function PixelSender (liveConnectConfig, calls, eventBus, onload, presend
})
}

function _callBakers (bakersJson) {
function _callBakers (bakersJson, xhr) {
try {
const bakers = JSON.parse(bakersJson).bakers
if (isArray(bakers)) {
for (let i = 0; i < bakers.length; i++) calls.pixelGet(`${bakers[i]}?dtstmp=${utcMillis()}`)
}
} catch (e) {
eventBus.emitErrorWithMessage('CallBakers', `Error while calling bakers with ${bakersJson}`, e)
eventBus.emitErrorWithMessage('CallBakers', `Error while calling bakers with ${JSON.stringify(bakersJson)}. Status: ${xhr.status}`, e)
}
}

Expand Down

0 comments on commit 9481364

Please sign in to comment.