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

handle document not found error in avatax during cancel #1573

Merged
merged 4 commits into from
Sep 16, 2024

Conversation

lkostrowski
Copy link
Member

Scope of the PR

Related issues

Checklist

@lkostrowski lkostrowski requested a review from a team as a code owner September 13, 2024 08:00
@lkostrowski lkostrowski requested review from a team and poulch September 13, 2024 08:00
Copy link

vercel bot commented Sep 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
saleor-app-avatax ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 10:28am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
saleor-app-cms ⬜️ Skipped (Inspect) 💬 Add feedback Sep 16, 2024 10:28am
saleor-app-data-importer ⬜️ Skipped (Inspect) 💬 Add feedback Sep 16, 2024 10:28am
saleor-app-klaviyo ⬜️ Skipped (Inspect) Sep 16, 2024 10:28am
saleor-app-products-feed ⬜️ Skipped (Inspect) 💬 Add feedback Sep 16, 2024 10:28am
saleor-app-search ⬜️ Skipped (Inspect) 💬 Add feedback Sep 16, 2024 10:28am
saleor-app-smtp ⬜️ Skipped (Inspect) 💬 Add feedback Sep 16, 2024 10:28am

Copy link

changeset-bot bot commented Sep 13, 2024

🦋 Changeset detected

Latest commit: 2e0263d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
app-avatax Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

});

return res.status(400).end();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: what about other type of error? Shoudn't we have here 500 returned and error logged to Sentry?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, good point

* Locally extract error code - but this should be more global, with some normalization/parsing logic/middleware
*/
private extractAvaTaxErrorCode = (error: unknown): string | null => {
const parsedError = z.object({ code: z.string() }).safeParse(error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: can't we have enum here and add support for additional error codes like https://github.com/saleor/apps/blob/main/apps/avatax/src/modules/avatax/avatax-errors-parser.ts ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!

error: e,
});

return res.status(400).end();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Let's send JSON here so Saleor can show what is happening in the logs 😄

@vercel vercel bot temporarily deployed to Preview – saleor-app-search September 16, 2024 09:39 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-data-importer September 16, 2024 09:39 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-products-feed September 16, 2024 09:39 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-cms September 16, 2024 09:39 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-smtp September 16, 2024 09:39 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-klaviyo September 16, 2024 09:39 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-smtp September 16, 2024 09:55 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-search September 16, 2024 09:55 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-data-importer September 16, 2024 09:55 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-cms September 16, 2024 09:55 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-products-feed September 16, 2024 09:55 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-klaviyo September 16, 2024 09:55 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-cms September 16, 2024 10:26 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-products-feed September 16, 2024 10:26 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-data-importer September 16, 2024 10:26 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-klaviyo September 16, 2024 10:26 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-search September 16, 2024 10:26 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-smtp September 16, 2024 10:26 Inactive
@lkostrowski lkostrowski enabled auto-merge (squash) September 16, 2024 10:28
@lkostrowski lkostrowski merged commit 5f61e62 into main Sep 16, 2024
17 checks passed
@lkostrowski lkostrowski deleted the error-void-transaction-due-to-missing-document branch September 16, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants