Logging Order Errors
How can we log order errors and some other metadata so that we can be of better help to our users when they run into problems?
You can add a callback function to the orderErrors
variable on orderJourney
state submodule by calling the onChange
function:
const ourLoggingFunction = () => {}
window.hapi.orderJourney.state.orderErrors.onChange((errors) => {
// extend the logs object to your choosing
const logs = {
campaignForm: window.hapi.campaign.state.campaignForm.value,
wallet: window.hapi.wallet.state.wallet.value,
basketProducts: window.hapi.basket.state.products.value,
errors
};
ourLoggingFunction(logs);
})