Skip to content

Make validateRequiredField & validateOptionalField errors more specific #2858

Open
@achowdhry-ripple

Description

@achowdhry-ripple

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions