Skip to content

Commit

Permalink
error handling update
Browse files Browse the repository at this point in the history
  • Loading branch information
carson-campbell committed Jan 30, 2025
1 parent db95768 commit 11f838b
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions packages/template-retail-react-app/app/hooks/use-datacloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,11 @@ export class DataCloudApi {
]
}

logger.info(
`Datacloud sendViewPage Event : ${JSON.stringify(interaction)}`,
{namespace: 'datacloudEvents'}
)

this.sdk.webEventsAppSourceIdPost(interaction)
try {
this.sdk.webEventsAppSourceIdPost(interaction)
} catch (err) {
logger.error('Error sending DataCloud event')
}
}

async sendViewProduct(product, args) {
Expand Down Expand Up @@ -152,11 +151,11 @@ export class DataCloudApi {
]
}

logger.info(
`Datacloud sendViewProduct (PDP) Event : ${JSON.stringify(interaction)}`,
{namespace: 'datacloudEvents'}
)
this.sdk.webEventsAppSourceIdPost(interaction)
try {
this.sdk.webEventsAppSourceIdPost(interaction)
} catch (err) {
logger.error('Error sending DataCloud event')
}
}

async sendViewCategory(searchParams, category, searchResults, args) {
Expand Down Expand Up @@ -197,11 +196,11 @@ export class DataCloudApi {
]
}

logger.info(
`Datacloud sendViewCategory (PLP) Event : ${JSON.stringify(interaction)}`,
{namespace: 'datacloudEvents'}
)
this.sdk.webEventsAppSourceIdPost(interaction)
try {
this.sdk.webEventsAppSourceIdPost(interaction)
} catch (err) {
logger.error('Error sending DataCloud event')
}
}

async sendViewSearchResults(searchParams, searchResults, args) {
Expand Down Expand Up @@ -242,11 +241,11 @@ export class DataCloudApi {
]
}

logger.info(
`Datacloud sendViewSearchResults Event : ${JSON.stringify(interaction)}`,
{namespace: 'datacloudEvents'}
)
this.sdk.webEventsAppSourceIdPost(interaction)
try {
this.sdk.webEventsAppSourceIdPost(interaction)
} catch (err) {
logger.error('Error sending DataCloud event')
}
}

async sendViewRecommendations(recommenderDetails, products, args) {
Expand Down Expand Up @@ -284,11 +283,11 @@ export class DataCloudApi {
]
}

logger.info(
`Datacloud sendViewRecommendations Event : ${JSON.stringify(interaction)}`,
{namespace: 'datacloudEvents'}
)
this.sdk.webEventsAppSourceIdPost(interaction)
try {
this.sdk.webEventsAppSourceIdPost(interaction)
} catch (err) {
logger.error('Error sending DataCloud event')
}
}
}

Expand Down

0 comments on commit 11f838b

Please sign in to comment.