Skip to content

Commit

Permalink
fix: http message error
Browse files Browse the repository at this point in the history
  • Loading branch information
maelgangloff committed Aug 7, 2024
1 parent a0d2639 commit cbd73aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Service/RDAPService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -130,6 +131,7 @@ public function registerDomains(array $domains): void
* @throws RedirectionExceptionInterface
* @throws DecodingExceptionInterface
* @throws ClientExceptionInterface
* @throws \Throwable
*/
public function registerDomain(string $fqdn): Domain
{
Expand Down Expand Up @@ -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,
Expand All @@ -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;
}

Expand Down

0 comments on commit cbd73aa

Please sign in to comment.