From cbd73aad4e58086150953f9884916f378697bc57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Wed, 7 Aug 2024 16:29:37 +0200 Subject: [PATCH] fix: http message error --- src/Service/RDAPService.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Service/RDAPService.php b/src/Service/RDAPService.php index 986f1a5..e006fd0 100644 --- a/src/Service/RDAPService.php +++ b/src/Service/RDAPService.php @@ -116,6 +116,7 @@ public static function isToBeWatchClosely(Domain $domain, \DateTimeImmutable $up * @throws HttpExceptionInterface * @throws TransportExceptionInterface * @throws DecodingExceptionInterface + * @throws \Throwable */ public function registerDomains(array $domains): void { @@ -130,6 +131,7 @@ public function registerDomains(array $domains): void * @throws RedirectionExceptionInterface * @throws DecodingExceptionInterface * @throws ClientExceptionInterface + * @throws \Throwable */ public function registerDomain(string $fqdn): Domain { @@ -162,7 +164,7 @@ public function registerDomain(string $fqdn): Domain $res = $this->client->request( 'GET', $rdapServerUrl.'domain/'.$idnDomain )->toArray(); - } catch (ClientException $e) { + } catch (\Throwable $e) { if (null !== $domain) { $this->logger->notice('The domain name {idnDomain} has been deleted from the WHOIS database.', [ 'idnDomain' => $idnDomain, @@ -173,6 +175,11 @@ public function registerDomain(string $fqdn): Domain $this->em->persist($domain); $this->em->flush(); } + + if ($e instanceof ClientException && 404 === $e->getResponse()->getStatusCode()) { + throw new NotFoundHttpException('The domain name is not present in the WHOIS database.'); + } + throw $e; }