diff options
author | Ignace Nyamagana Butera <nyamsprod@gmail.com> | 2015-02-17 10:27:30 +0100 |
---|---|---|
committer | Ignace Nyamagana Butera <nyamsprod@gmail.com> | 2015-02-17 10:52:15 +0100 |
commit | 1b6de5f30379f1fd9e698c68d1ba8a0d5dca59ee (patch) | |
tree | 4d1d499392a1b6f7beb099ecf2e54381ea315a6b /src | |
parent | 4cc2b181d89dcfe39b9111fa6c71951f2b06442d (diff) | |
download | csv-1b6de5f30379f1fd9e698c68d1ba8a0d5dca59ee.zip csv-1b6de5f30379f1fd9e698c68d1ba8a0d5dca59ee.tar.gz csv-1b6de5f30379f1fd9e698c68d1ba8a0d5dca59ee.tar.bz2 |
adding Specific exception for Writer validation
Diffstat (limited to 'src')
-rw-r--r-- | src/Exception/ValidationException.php | 26 | ||||
-rw-r--r-- | src/Writer.php | 3 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/Exception/ValidationException.php b/src/Exception/ValidationException.php new file mode 100644 index 0000000..8a7e113 --- /dev/null +++ b/src/Exception/ValidationException.php @@ -0,0 +1,26 @@ +<?php +/** +* This file is part of the League.csv library +* +* @license http://opensource.org/licenses/MIT +* @link https://github.com/thephpleague/csv/ +* @version 7.0.0 +* @package League.csv +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ +namespace League\Csv\Exception; + +use InvalidArgumentException; + +/** + * Thrown when a data is not validated prior to insertion + * + * @package League.csv + * @since 7.0.0 + * + */ +class ValidationException extends InvalidArgumentException +{ +} diff --git a/src/Writer.php b/src/Writer.php index f5ff007..b7f95e9 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -13,6 +13,7 @@ namespace League\Csv; use InvalidArgumentException; +use League\Csv\Exception\ValidationException; use League\Csv\Exporter; use Traversable; @@ -84,7 +85,7 @@ class Writer extends AbstractCsv { $row = $this->formatRow($row); if ($this->validators && ! $this->validateRow($row)) { - throw new InvalidArgumentException( + throw new ValidationException( 'Row validation failed with the following validator: '. $this->lastValidatorErrorName ); } |