From 8f7a1293545f00575910c4512405e309423bccf9 Mon Sep 17 00:00:00 2001 From: Dag Date: Thu, 21 Apr 2022 20:20:06 +0200 Subject: [PATCH] fix: throw proper UrlException --- src/Url.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Url.php b/src/Url.php index 66ceabd..6efceb7 100755 --- a/src/Url.php +++ b/src/Url.php @@ -3,6 +3,8 @@ declare(strict_types=1); namespace Thirdplace; +final class UrlException extends \Exception {} + function url(string $url): Url { return Url::fromString($url); @@ -24,7 +26,7 @@ final class Url implements \JsonSerializable $url = trim($url); if (!self::validate($url)) { - throw new \Exception(sprintf('Not valid: "%s"', $url)); + throw new UrlException(sprintf('Illegal url: "%s"', $url)); } return (new self) -- 2.45.2