This commit is contained in:
2023-10-02 23:10:49 +03:00
commit c6cb488379
255 changed files with 18731 additions and 0 deletions
@@ -0,0 +1,32 @@
<?php
namespace Lucent\Schema\Validator;
use Exception;
final class ValidatorException extends Exception
{
private array $validatorErrors;
// Redefine the exception so message isn't optional
public function __construct(array $message, int $code = 0, Exception $previous = null)
{
// make sure everything is assigned properly
$this->validatorErrors = $message;
parent::__construct("You have one or more validation errors", $code, $previous);
}
public function getValidatorErrors(): array
{
return $this->validatorErrors;
}
public function getFirstValidatorError(): array
{
return (array)array_shift($this->validatorErrors);
}
}