-
Notifications
You must be signed in to change notification settings - Fork 220
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
Translate possible cases of ErrBalanceTx
to ErrCreatePayment
#4891
Conversation
@@ -55,15 +78,108 @@ import qualified Data.Text as T | |||
|
|||
data ErrCreatePayment | |||
= ErrCreatePaymentNotRecentEra (Read.EraValue Read.Era) | |||
| ErrCreatePaymentBalanceTx (Write.ErrBalanceTx Write.Conway) | |||
| ErrNotEnoughAda { shortfall :: Value } |
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.
Only providing the shortfall
field allows us to merge Write.ErrBalanceTxAssetsInsufficient
and Write.ErrBalanceTxUnableToCreateChange
, which seems desirable. We'd probably ideally want some more info though.
@@ -16,6 +16,7 @@ module Cardano.Wallet.Deposit.Write | |||
, TxBody (..) | |||
, TxIn | |||
, TxOut | |||
, Coin |
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.
Hm, this is probably clashes with the read Coin type
lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/State/Payment.hs
Outdated
Show resolved
Hide resolved
176bfe7
to
3210b4a
Compare
a6eab87
to
1056717
Compare
@@ -5115,6 +5115,7 @@ x-errTxNotInNodeEra: &errTxNotInNodeEra | |||
x-errBalanceTxConflictingNetworks: &errBalanceTxConflictingNetworks | |||
<<: *responsesErr | |||
title: balance_tx_conflicting_networks | |||
deprecated: true # TODO: Remove this error as soon as bump.sh allows us to |
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.
Techincally this isn't just deprecated, it has already been removed. But bump.sh doesn't know that the open-api-spec is to be used by clients, and not alternative servers. Removing an error case from the schema error doesn't affect clients.
9b69756
to
7c1f034
Compare
- Deprecate the error in swagger for now, as bump.sh would deem its removal as breaking and fail.
7c1f034
to
d7594b4
Compare
d7594b4
to
5dd13df
Compare
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.
Thanks!
apiError err403 BalanceTxConflictingNetworks $ T.unwords | ||
[ "There are withdrawals for multiple networks (e.g. both" | ||
, "mainnet and testnet) in the provided transaction. This" | ||
, "makes no sense, and I'm confused." |
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 personally do not like the code-is-person style, but I also don't want to discuss style :-)
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.
Yeah, I'm not too fond of it either! I think both because it may add verbosity / make messages more difficult to parse quickly and because it's deceptive; the cardano-wallet API is neither LLM nor actual human... And the combination friendly yet unhelpful/frustrating error messages is a risk.
(I've stuck with it in the cardano-wallet api for concistency though)
#4891) - Drop unused `ErrBalanceTxConflictingNetworks` - Add details to ErrBalanceTxMaxSizeLimitExceeded - Translate possible cases of `ErrBalanceTx` to `ErrCreatePayment` ### Comments <img width="1198" alt="Skärmavbild 2024-12-19 kl 12 25 15" src="https://github.com/user-attachments/assets/7de1ccd1-2fc0-4bd8-ab4e-8f87f56bec0b" /> <img width="1194" alt="Skärmavbild 2024-12-19 kl 12 49 57" src="https://github.com/user-attachments/assets/266a41c2-4a17-4012-901d-34d5ec1d2c03" /> <img width="1189" alt="Skärmavbild 2024-12-19 kl 12 49 47" src="https://github.com/user-attachments/assets/87cd945a-a6b9-4be7-b6fd-effa9a4d5671" /> <img width="1165" alt="Skärmavbild 2024-12-19 kl 17 11 03" src="https://github.com/user-attachments/assets/66996bba-33fe-44c7-8a36-bdf6ece3896a" /> ### Issue Number fixes #4877 Source commit: dec3bbb
ErrBalanceTxConflictingNetworks
ErrBalanceTx
toErrCreatePayment
Comments
Issue Number
fixes #4877