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

[ADP-3306] Make more HTTP API errors machine-readable. #4622

Merged
merged 14 commits into from
Jun 13, 2024

Conversation

paweljakubas
Copy link
Contributor

@paweljakubas paweljakubas commented Jun 7, 2024

  • Convert to machine-readable error: AssetNotPresent
  • Convert to machine-readable error: OutputTokenBundleSizeExceedsLimit
  • Convert to machine-readable error: OutputTokenQuantityExceedsLimit
  • Convert to machine-readable error: TransactionAlreadyInLedger
  • Convert to machine-readable error: WrongEncryptionPassphrase

Issue Number

ADP-3306

@paweljakubas paweljakubas self-assigned this Jun 7, 2024
Copy link
Member

@jonathanknowles jonathanknowles left a comment

Choose a reason for hiding this comment

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

Hi @paweljakubas

Thanks for making this PR!

I have two general comments:

lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs Outdated Show resolved Hide resolved
lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs Outdated Show resolved Hide resolved
lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs Outdated Show resolved Hide resolved
@@ -293,6 +301,34 @@ data ApiErrorTxOutputLovelaceInsufficient = ApiErrorTxOutputLovelaceInsufficient
via DefaultRecord ApiErrorTxOutputLovelaceInsufficient
deriving anyclass NFData

data ApiErrorOutputTokenQuantityExceedsLimit = ApiErrorOutputTokenQuantityExceedsLimit
{ address
:: !Text
Copy link
Member

@jonathanknowles jonathanknowles Jun 11, 2024

Choose a reason for hiding this comment

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

Can we replace this with ApiAnyAddress?

Suggested change
:: !Text
:: !ApiAnyAddress

lib/api/src/Cardano/Wallet/Api/Types/Error.hs Outdated Show resolved Hide resolved
lib/api/src/Cardano/Wallet/Api/Types/Error.hs Outdated Show resolved Hide resolved
lib/api/src/Cardano/Wallet/Api/Types/Error.hs Outdated Show resolved Hide resolved
lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs Outdated Show resolved Hide resolved
In this commit, we wrap excessively-long lines to fit within the line
length limit (80 characters).
@jonathanknowles jonathanknowles changed the title More errors refactoring Make more HTTP API errors machine-readable. Jun 12, 2024
The `bundle_size` field value can never be negative.
The `bundle_size` field value can never be negative.
We can no longer use invalid values for `policy_id` and `asset_name`.
@jonathanknowles jonathanknowles changed the title Make more HTTP API errors machine-readable. [ADP-3306] Make more HTTP API errors machine-readable. Jun 13, 2024
Copy link
Member

@jonathanknowles jonathanknowles left a comment

Choose a reason for hiding this comment

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

LGTM! 👍🏻

I think it makes sense to defer making a decision on using a more dedicated type for the address fields for now. Switching to ApiAddress n, where n is a NetworkDiscriminant would require quite a few invasive changes.

@jonathanknowles jonathanknowles added this pull request to the merge queue Jun 13, 2024
Merged via the queue into master with commit b5b9f00 Jun 13, 2024
3 checks passed
@jonathanknowles jonathanknowles deleted the paweljakubas/adp-3306/more-errors-refactoring branch June 13, 2024 09:01
WilliamKingNoel-Bot pushed a commit that referenced this pull request Jun 13, 2024
…- [x] Convert to machine-readable error: `AssetNotPresent` - [x] Convert to machine-readable error: `OutputTokenBundleSizeExceedsLimit` - [x] Convert to machine-readable error: `OutputTokenQuantityExceedsLimit` - [x] Convert to machine-readable error: `TransactionAlreadyInLedger` - [x] Convert to machine-readable error: `WrongEncryptionPassphrase` ### Issue Number ADP-3306 Source commit: b5b9f00
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.

3 participants