Skip to content

Should customize error message #9

Description

@lucasdaiki

When a entity is not valid, the error property is:

{ property1: { errors: [ 'Required undefined `property1` was not specified in `FakeEntity`.' ] } }

But the error message is not friendly to application user.

I suggest to add a new param in validation:

class FakeEntity extends Speck {
    static SCHEMA = {
        property1: {
            validator: Proptypes.number.isRequired,
            errorMessage: 'Property1 must be a number'
        }
    }
}

So, the error message will be:

{ property1: { errors: ['Property1 must be a number' ] } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions