Skip to content

Make validateRequiredField & validateOptionalField errors more specific #2858

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

Open
achowdhry-ripple opened this issue Dec 20, 2024 · 1 comment · May be fixed by #2895
Open

Make validateRequiredField & validateOptionalField errors more specific #2858

achowdhry-ripple opened this issue Dec 20, 2024 · 1 comment · May be fixed by #2895

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

lacostenycoder added a commit to lacostenycoder/xrpl.js that referenced this issue Apr 9, 2025
lacostenycoder added a commit to lacostenycoder/xrpl.js that referenced this issue Apr 9, 2025
lacostenycoder added a commit to lacostenycoder/xrpl.js that referenced this issue Apr 9, 2025
@lacostenycoder
Copy link

@achowdhry-ripple @mvadari PR open and ready for review.

@mvadari mvadari linked a pull request Apr 10, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants