Skip to content

Provide an easier way for the user to add custom errors to an existing validationResult object #77

@doover

Description

@doover

Summary

Provide an easier way for the user to add custom errors to an existing validationResult object

Detailed Description

Currently, the developer can create a new validationError object two ways:

Use newError(ARGUMENTS)

Or use getInstance('cbvalidation.models.result.ValidationError') and then populate that error object

Then the developer has to use addError() to add it to the ValidationResult.

Propose a new feature - something like addNewError() (not a terribly good name) that would accept all the arguments for a validationError (like newError) and add it to the list of errors (like addError).

Possible Implementation Ideas

    /**
     * Create a new error, then add it to the current error array
     * 
     * @arguments all fields that would be part of a validationError object
     */
    any function addNewError() {
        addError(duplicate(errorTemplate).configure(argumentCollection = arguments));
        return this;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions