Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add helpful exceptions for userland / traits #8

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Exception/InvalidSignatureException.php
@@ -0,0 +1,21 @@
<?php

/*
* This file is part of the SymfonyCasts VerifyEmailBundle package.
* Copyright (c) SymfonyCasts <https://symfonycasts.com/>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace SymfonyCasts\Bundle\VerifyEmail\Exception;

/**
* @author Jesse Rushlow <jr@rushlow.dev>
*/
final class InvalidSignatureException extends \Exception implements VerifyEmailExceptionInterface
{
public function getReason(): string
{
return 'The signature could not be validated.';
}
}
6 changes: 6 additions & 0 deletions tests/UnitTests/Exception/VerifyEmailExceptionTest.php
Expand Up @@ -11,6 +11,7 @@

use PHPUnit\Framework\TestCase;
use SymfonyCasts\Bundle\VerifyEmail\Exception\ExpiredSignatureException;
use SymfonyCasts\Bundle\VerifyEmail\Exception\InvalidSignatureException;
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;

/**
Expand All @@ -24,6 +25,11 @@ public function exceptionDataProvider(): \Generator
ExpiredSignatureException::class,
'The link to verify your email has expired. Please request a new link.',
];

yield [
InvalidSignatureException::class,
'The signature could not be validated.',
];
}

/**
Expand Down