~thirdplace/components

8f7a1293545f00575910c4512405e309423bccf9 — Dag 1 year, 5 months ago e8fb90e
fix: throw proper UrlException
1 files changed, 3 insertions(+), 1 deletions(-)

M src/Url.php
M src/Url.php => src/Url.php +3 -1
@@ 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)