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

Make validateRequiredField & validateOptionalField errors more specific #2858

Open
achowdhry-ripple opened this issue Dec 20, 2024 · 0 comments

Comments

@achowdhry-ripple
Copy link
Collaborator

achowdhry-ripple commented Dec 20, 2024

In packages/xrpl/src/models/transactions/common.ts, we currently have two helper functions that are the standard for all transaction validate functions to use for each field.
-validateRequiredField()
-validateOptionalField()

However, the message is vague ("invalid field XXX", etc), and we would like to tailor the message to the exact type for better user experience and debugging. For example, "Invalid field XXX" should become "XXX must be a string", and the type can either be inferred by the checkValidity parameter of these helper methods or a new parameter can be added for the exact type to provide in the error messaging (there is flexibility with the exact formatting, can be "Expected type String, received type YYY", etc)

Conversation: https://github.com/XRPLF/xrpl.js/pull/2829/files#r1893062063

Noticed in #2829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant