Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 capture Contentful exception #1066

Merged
merged 4 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shiny-mails-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-app-cms-v2": patch
---

Fixed the issue with `uploadProductVariant` error not being captured in Sentry.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ export class ContentfulClient {

/**
* Support only en-US locale now
* todo: throw specific error if locale is not en-US
*/
private mapVariantToConfiguredFields = (
variant: WebhookProductVariantFragment,
productVariantFieldsMapping: ContentfulProviderConfig.FullShape["productVariantFieldsMapping"]
productVariantFieldsMapping: ContentfulProviderConfig.FullShape["productVariantFieldsMapping"],
) => {
const {
channels,
Expand Down Expand Up @@ -119,7 +120,7 @@ export class ContentfulClient {

entry.fields = this.mapVariantToConfiguredFields(
variant,
configuration.productVariantFieldsMapping
configuration.productVariantFieldsMapping,
);

return entry.update();
Expand Down Expand Up @@ -188,6 +189,7 @@ export class ContentfulClient {
return this.updateProductVariant(opts);
} else {
Sentry.captureMessage("Contentful error failed and is not handled");
Sentry.captureException(e);
throw e;
}
}
Expand Down