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(swap): handle errors from order posting API #3224

Merged
merged 3 commits into from
Oct 16, 2023
Merged

Conversation

shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented Oct 13, 2023

Summary

Fixes #3217

Before the fix, we naively used getProviderErrorMessage() to parse an error. But the error might be an instance of OrderBookApiError.

image

To Test

  1. Sen an order to SWAP in your wallet
  2. Wait for 2.5 min
  3. Sign it
  • "could not find quote with the specified ID" error should be displayed in the modal

@vercel
Copy link

vercel bot commented Oct 13, 2023

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

Name Status Preview Updated (UTC)
swap-dev ✅ Ready (Inspect) Visit Preview Oct 13, 2023 0:44am

🌃 Cosmos ↗︎

@shoom3301 shoom3301 changed the base branch from develop to release/1.48.0 October 13, 2023 10:27
@shoom3301 shoom3301 requested a review from a team October 13, 2023 10:29
@shoom3301 shoom3301 self-assigned this Oct 13, 2023
@shoom3301 shoom3301 added the RELEASE Included in the release that is being closed label Oct 13, 2023
Copy link
Collaborator

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

One nitpick

const defaultErrorMessage = getProviderErrorMessage(error)

if (getIsOrderBookTypedError(error)) {
return capitalizeFirstLetter(error.body?.description) || defaultErrorMessage
Copy link
Contributor

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?

Copy link
Collaborator Author

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

@alfetopito alfetopito merged commit 99df6d2 into release/1.48.0 Oct 16, 2023
7 checks passed
@alfetopito alfetopito deleted the fix/3217 branch October 16, 2023 10:51
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
RELEASE Included in the release that is being closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.48.0] Bad error handling posting orders
3 participants