init
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user