mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: throw UnrecoverableMessageHandlingException if the domain name cannot be updated
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\MessageHandler;
|
namespace App\MessageHandler;
|
||||||
|
|
||||||
|
use App\Entity\Domain;
|
||||||
use App\Entity\RdapServer;
|
use App\Entity\RdapServer;
|
||||||
use App\Entity\Watchlist;
|
use App\Entity\Watchlist;
|
||||||
use App\Exception\DomainNotFoundException;
|
use App\Exception\DomainNotFoundException;
|
||||||
@@ -23,6 +24,7 @@ use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
|||||||
use Symfony\Component\Mailer\MailerInterface;
|
use Symfony\Component\Mailer\MailerInterface;
|
||||||
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
||||||
use Symfony\Component\Messenger\Exception\ExceptionInterface;
|
use Symfony\Component\Messenger\Exception\ExceptionInterface;
|
||||||
|
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
|
||||||
use Symfony\Component\Messenger\MessageBusInterface;
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
use Symfony\Component\Messenger\Stamp\TransportNamesStamp;
|
use Symfony\Component\Messenger\Stamp\TransportNamesStamp;
|
||||||
use Symfony\Component\Mime\Address;
|
use Symfony\Component\Mime\Address;
|
||||||
@@ -61,7 +63,6 @@ final readonly class UpdateDomainHandler
|
|||||||
* @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface
|
* @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface
|
||||||
* @throws UnsupportedDsnSchemeException
|
* @throws UnsupportedDsnSchemeException
|
||||||
* @throws ServerExceptionInterface
|
* @throws ServerExceptionInterface
|
||||||
* @throws MalformedDomainException
|
|
||||||
* @throws ExceptionInterface
|
* @throws ExceptionInterface
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
@@ -78,7 +79,7 @@ final readonly class UpdateDomainHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $domain) {
|
if (null === $domain) {
|
||||||
$this->RDAPService->registerDomain($message->ldhName);
|
$this->registerDomain($message->ldhName);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -122,7 +123,7 @@ final readonly class UpdateDomainHandler
|
|||||||
* Domain name update
|
* Domain name update
|
||||||
* We send messages that correspond to the sending of notifications that will not be processed here.
|
* We send messages that correspond to the sending of notifications that will not be processed here.
|
||||||
*/
|
*/
|
||||||
$this->RDAPService->registerDomain($domain->getLdhName());
|
$this->registerDomain($domain->getLdhName());
|
||||||
|
|
||||||
/** @var Watchlist $wl */
|
/** @var Watchlist $wl */
|
||||||
foreach ($domain->getWatchlists()->getIterator() as $wl) {
|
foreach ($domain->getWatchlists()->getIterator() as $wl) {
|
||||||
@@ -150,4 +151,27 @@ final readonly class UpdateDomainHandler
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws OptimisticLockException
|
||||||
|
* @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface
|
||||||
|
* @throws ServerExceptionInterface
|
||||||
|
* @throws RedirectionExceptionInterface
|
||||||
|
* @throws DecodingExceptionInterface
|
||||||
|
* @throws ClientExceptionInterface
|
||||||
|
*/
|
||||||
|
private function registerDomain(string $ldhName): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->RDAPService->registerDomain($ldhName);
|
||||||
|
} catch (
|
||||||
|
DomainNotFoundException|
|
||||||
|
TldNotSupportedException|
|
||||||
|
MalformedDomainException|
|
||||||
|
UnknownRdapServerException
|
||||||
|
$exception
|
||||||
|
) {
|
||||||
|
throw new UnrecoverableMessageHandlingException($exception->getMessage(), 0, $exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ FROM (
|
|||||||
FROM entity e
|
FROM entity e
|
||||||
) sub
|
) sub
|
||||||
JOIN domain_entity de ON de.entity_uid = sub.id
|
JOIN domain_entity de ON de.entity_uid = sub.id
|
||||||
WHERE LOWER(org||fn) NOT LIKE '%redacted%'
|
WHERE LOWER(org||fn) NOT LIKE '%redacted for privacy%'
|
||||||
AND LOWER(org||fn) NOT LIKE '%privacy%'
|
AND LOWER(org||fn) NOT LIKE '%data protected%'
|
||||||
AND LOWER(org||fn) NOT LIKE '%registration private%'
|
AND LOWER(org||fn) NOT LIKE '%registration private%'
|
||||||
AND LOWER(org||fn) NOT LIKE '%domain administrator%'
|
AND LOWER(org||fn) NOT LIKE '%domain administrator%'
|
||||||
AND LOWER(org||fn) NOT LIKE '%registry super user account%'
|
AND LOWER(org||fn) NOT LIKE '%registry super user account%'
|
||||||
AND LOWER(org||fn) NOT LIKE '%ano nymous%'
|
AND LOWER(org||fn) not like '%ano nymous%'
|
||||||
AND LOWER(org||fn) NOT LIKE '%by proxy%'
|
AND LOWER(org||fn) not in ('na', 'n/a', '-', 'none', 'not applicable')
|
||||||
AND handle NOT IN ($handleBlacklist)
|
AND handle NOT IN ($handleBlacklist)
|
||||||
AND de.roles @> '["registrant"]'
|
AND de.roles @> '["registrant"]'
|
||||||
AND sub.tld_id IS NOT NULL
|
AND sub.tld_id IS NOT NULL
|
||||||
|
|||||||
Reference in New Issue
Block a user