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