From 85f4843df7df01847dc8973ce78fcef0409cf3c0 Mon Sep 17 00:00:00 2001 From: Alexandre Gomes Gaigalas Date: Sat, 25 Sep 2010 02:54:10 -0300 Subject: [PATCH] Better exceptions --- .../Respect/Validation/Date/AbstractDateException.php | 8 -------- library/Respect/Validation/Date/OutOfBoundsException.php | 2 +- .../Respect/Validation/String/EmptyStringException.php | 8 ++++++++ library/Respect/Validation/String/NotEmpty.php | 9 ++++++++- 4 files changed, 17 insertions(+), 10 deletions(-) delete mode 100644 library/Respect/Validation/Date/AbstractDateException.php create mode 100644 library/Respect/Validation/String/EmptyStringException.php diff --git a/library/Respect/Validation/Date/AbstractDateException.php b/library/Respect/Validation/Date/AbstractDateException.php deleted file mode 100644 index 489f59c2..00000000 --- a/library/Respect/Validation/Date/AbstractDateException.php +++ /dev/null @@ -1,8 +0,0 @@ - 'You provided an empty string' + ); public function validate($input) { @@ -17,7 +22,9 @@ class NotEmpty extends AbstractRule implements Validatable public function assert($input) { if (!$this->validate($input)) - throw new Exception(); + throw new EmptyStringException( + $this->getMessage(self::MSG_EMPTY_STRING) + ); } } \ No newline at end of file