-
Notifications
You must be signed in to change notification settings - Fork 347
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
handle document not found error in avatax during cancel #1573
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Skipped Deployments
|
🦋 Changeset detectedLatest commit: 2e0263d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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(); | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 😄
Scope of the PR
Related issues
Checklist