-
Notifications
You must be signed in to change notification settings - Fork 101
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(swap): handle errors from order posting API #3224
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
One nitpick
apps/cowswap-frontend/src/modules/trade/utils/swapErrorHelper.ts
Outdated
Show resolved
Hide resolved
apps/cowswap-frontend/src/modules/trade/utils/swapErrorHelper.ts
Outdated
Show resolved
Hide resolved
const defaultErrorMessage = getProviderErrorMessage(error) | ||
|
||
if (getIsOrderBookTypedError(error)) { | ||
return capitalizeFirstLetter(error.body?.description) || defaultErrorMessage |
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.
don't we do the mapping if the type is know?
export enum ApiErrorCodeDetails { |
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.
I think it's better to show an error as it is. Having this we can change the text on backend side on flight
Summary
Fixes #3217
Before the fix, we naively used
getProviderErrorMessage()
to parse an error. But the error might be an instance ofOrderBookApiError
.To Test