-
Notifications
You must be signed in to change notification settings - Fork 50
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): Fix swap cancellation fee error handling #2784
Conversation
Lgtm. API said that order in particular was faulty and that's why cancellation doesn't work. |
apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/ListOrders/OpenOrders.tsx
Show resolved
Hide resolved
460, | ||
) | ||
} catch (error) { | ||
if (error instanceof 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.
is this if required?
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 is unknown
in the catch and we would not be able to access error.message
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.
in that case we need also an alert on the else side, if somewhere deep something else is thrown.
Alert.alert(strings.generalErrorTitle, strings.generalErrorMessage(error.message)) | ||
} |
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.
Alert.alert(strings.generalErrorTitle, strings.generalErrorMessage(error.message)) | |
} | |
Alert.alert(strings.generalErrorTitle, strings.generalErrorMessage(error.message)) | |
} else { | |
Alert.alert(strings.generalErrorTitle, strings.generalErrorMessage(/* stringify the error - default error unknown? */)) | |
} |
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.
smth alike
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.
That's now updated
resolves https://emurgo.atlassian.net/browse/YOMO-881
This PR only improves error handling, however there may be cases when the REST API does not respond with CBOR such as in this example
https://aggregator.muesliswap.com/cancelSwapTransaction/?wallet=01417232dba248bdd316442f323c4279fb1e0ef7bfb16680d8dabdd655f9ea671653e35395356465e4bd8f563b5d5480e4eb466da896a22afc&utxo=8956d68753d718afbaafde0e83dc1cb1d205da3c89fb08c924ab1d63fd953ed2%230&collateralUtxo=82825820926f781eea85507363790aca75e4e4a05ff6a0ad1c8b823db4074fd515b521a80082583901417232dba248bdd316442f323c4279fb1e0ef7bfb16680d8dabdd655f9ea671653e35395356465e4bd8f563b5d5480e4eb466da896a22afc1a001e8480