add a specific exception for invalid UUID string

This commit is contained in:
Massimiliano Arione
2017-03-11 10:52:53 +01:00
parent 47fcdc6341
commit a2647abc14
3 changed files with 25 additions and 2 deletions
+2 -1
View File
@@ -16,6 +16,7 @@ namespace Ramsey\Uuid\Codec;
use InvalidArgumentException;
use Ramsey\Uuid\Builder\UuidBuilderInterface;
use Ramsey\Uuid\Exception\InvalidUuidStringException;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
@@ -139,7 +140,7 @@ class StringCodec implements CodecInterface
$nameParsed = implode('-', $components);
if (!Uuid::isValid($nameParsed)) {
throw new InvalidArgumentException('Invalid UUID string: ' . $encodedUuid);
throw new InvalidUuidStringException('Invalid UUID string: ' . $encodedUuid);
}
return $components;