mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: correct HTTP codes for Bad Request
This commit is contained in:
@@ -38,6 +38,6 @@ api_platform:
|
|||||||
ApiPlatform\Validator\Exception\ValidationException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_UNPROCESSABLE_ENTITY
|
ApiPlatform\Validator\Exception\ValidationException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_UNPROCESSABLE_ENTITY
|
||||||
|
|
||||||
App\Exception\DomainNotFoundException: 404
|
App\Exception\DomainNotFoundException: 404
|
||||||
App\Exception\MalformedDomainException: 403
|
App\Exception\MalformedDomainException: 400
|
||||||
App\Exception\TldNotSupportedException: 403
|
App\Exception\TldNotSupportedException: 400
|
||||||
App\Exception\UnknownRdapServerException: 403
|
App\Exception\UnknownRdapServerException: 400
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ final readonly class UpdateDomainsFromWatchlistHandler
|
|||||||
private WatchListRepository $watchListRepository,
|
private WatchListRepository $watchListRepository,
|
||||||
private LoggerInterface $logger,
|
private LoggerInterface $logger,
|
||||||
#[Autowire(service: 'service_container')]
|
#[Autowire(service: 'service_container')]
|
||||||
private ContainerInterface $locator, private DomainRepository $domainRepository,
|
private ContainerInterface $locator,
|
||||||
|
private DomainRepository $domainRepository,
|
||||||
) {
|
) {
|
||||||
$this->sender = new Address($mailerSenderEmail, $mailerSenderName);
|
$this->sender = new Address($mailerSenderEmail, $mailerSenderName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,6 +224,9 @@ class RDAPService
|
|||||||
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
|
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
|
||||||
|
|
||||||
if (null === $tldEntity) {
|
if (null === $tldEntity) {
|
||||||
|
$this->logger->warning('Domain name cannot be updated because the TLD is not supported', [
|
||||||
|
'ldhName' => $domain,
|
||||||
|
]);
|
||||||
throw TldNotSupportedException::fromTld($domain);
|
throw TldNotSupportedException::fromTld($domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,6 +247,10 @@ class RDAPService
|
|||||||
$rdapServer = $this->rdapServerRepository->findOneBy(['tld' => $tldString], ['updatedAt' => 'DESC']);
|
$rdapServer = $this->rdapServerRepository->findOneBy(['tld' => $tldString], ['updatedAt' => 'DESC']);
|
||||||
|
|
||||||
if (null === $rdapServer) {
|
if (null === $rdapServer) {
|
||||||
|
$this->logger->warning('Unable to determine which RDAP server to contact', [
|
||||||
|
'tld' => $tldString,
|
||||||
|
]);
|
||||||
|
|
||||||
throw UnknownRdapServerException::fromTld($tldString);
|
throw UnknownRdapServerException::fromTld($tldString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user