class ValidationException extends Exception

Exception thrown by {@link DataObject}::write if validation fails. By throwing an exception rather than a user error, the exception can be caught in unit tests and as such can be used as a successful test.

Methods

__construct(ValidationResult|string $result = null, string|integer $message = null, integer $code)

Construct a new ValidationException with an optional ValidationResult object

getResult()

Retrieves the ValidationResult related to this error

Details

at line 30
__construct(ValidationResult|string $result = null, string|integer $message = null, integer $code)

Construct a new ValidationException with an optional ValidationResult object

Parameters

ValidationResult|string $result The ValidationResult containing the failed result. Can be substituted with an error message instead if no ValidationResult exists.
string|integer $message The error message. If $result was given the message string rather than a ValidationResult object then this will have the error code number.
integer $code The error code number, if not given in the second parameter

at line 57
ValidationResult getResult()

Retrieves the ValidationResult related to this error

Return Value

ValidationResult