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

Translate possible cases of ErrBalanceTx to ErrCreatePayment #4891

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

Anviking
Copy link
Member

@Anviking Anviking commented Dec 19, 2024

  • Drop unused ErrBalanceTxConflictingNetworks
  • Add details to ErrBalanceTxMaxSizeLimitExceeded
  • Translate possible cases of ErrBalanceTx to ErrCreatePayment

Comments

Skärmavbild 2024-12-19 kl  12 25 15 Skärmavbild 2024-12-19 kl  12 49 57 Skärmavbild 2024-12-19 kl  12 49 47 Skärmavbild 2024-12-19 kl  17 11 03

Issue Number

fixes #4877

@Anviking Anviking self-assigned this Dec 19, 2024
@@ -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 }
Copy link
Member Author

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
Copy link
Member Author

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

@Anviking Anviking force-pushed the anviking/ErrCreatePayment branch 4 times, most recently from 176bfe7 to 3210b4a Compare December 19, 2024 17:52
@Anviking Anviking force-pushed the anviking/ErrCreatePayment branch 4 times, most recently from a6eab87 to 1056717 Compare January 7, 2025 11:30
@@ -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
Copy link
Member Author

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.

@Anviking Anviking force-pushed the anviking/ErrCreatePayment branch 3 times, most recently from 9b69756 to 7c1f034 Compare January 7, 2025 15:04
- Deprecate the error in swagger for now, as bump.sh would deem its
  removal as breaking and fail.
@Anviking Anviking force-pushed the anviking/ErrCreatePayment branch from 7c1f034 to d7594b4 Compare January 7, 2025 15:33
@Anviking Anviking force-pushed the anviking/ErrCreatePayment branch from d7594b4 to 5dd13df Compare January 7, 2025 15:39
Copy link
Collaborator

@paolino paolino left a 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."
Copy link
Collaborator

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 :-)

Copy link
Member Author

@Anviking Anviking Jan 7, 2025

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)

@Anviking Anviking enabled auto-merge January 7, 2025 16:24
@Anviking Anviking added this pull request to the merge queue Jan 7, 2025
Merged via the queue into master with commit dec3bbb Jan 7, 2025
25 checks passed
@Anviking Anviking deleted the anviking/ErrCreatePayment branch January 7, 2025 22:43
WilliamKingNoel-Bot pushed a commit that referenced this pull request Jan 7, 2025
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translate possible ErrBalanceTx constructors to ErrCreatePayment
2 participants