replace Exception on GeneralException, InitializationException
This commit is contained in:
@ -27,7 +27,7 @@ class EqualValidator extends Validator
|
|||||||
{
|
{
|
||||||
$this->setValue($value);
|
$this->setValue($value);
|
||||||
if ($this->token === null) {
|
if ($this->token === null) {
|
||||||
throw new Exception('Token not defined.');
|
throw new InitializationException('Token not defined.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value !== $this->token) {
|
if ($value !== $this->token) {
|
||||||
|
@ -30,7 +30,7 @@ class RegexValidator extends Validator
|
|||||||
|
|
||||||
$status = preg_match($this->regex, $value);
|
$status = preg_match($this->regex, $value);
|
||||||
if ($status === false) {
|
if ($status === false) {
|
||||||
throw new Exception('Internal error matching regex "' . $this->regex . ' against value "' . $value . '"');
|
throw new GeneralException('Internal error matching regex "' . $this->regex . ' against value "' . $value . '"');
|
||||||
}
|
}
|
||||||
if (!$status) {
|
if (!$status) {
|
||||||
$this->error();
|
$this->error();
|
||||||
|
@ -51,7 +51,7 @@ abstract class Validator implements iValidator
|
|||||||
protected function createMessage($template, $value)
|
protected function createMessage($template, $value)
|
||||||
{
|
{
|
||||||
if (!isset($this->templates[$template])) {
|
if (!isset($this->templates[$template])) {
|
||||||
throw new Exception('Message template "' . $template . '" unknown.');
|
throw new GeneralException('Message template "' . $template . '" unknown.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $this->templates[$template];
|
$message = $this->templates[$template];
|
||||||
|
Reference in New Issue
Block a user