fix: http message error

This commit is contained in:
Maël Gangloff 2024-08-07 16:21:41 +02:00
parent 7902bfbe32
commit a0d2639311
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
2 changed files with 6 additions and 4 deletions

View File

@ -79,7 +79,7 @@ readonly class GandiConnector implements ConnectorInterface
if ((!$dryRun && Response::HTTP_ACCEPTED !== $res->getStatusCode()) if ((!$dryRun && Response::HTTP_ACCEPTED !== $res->getStatusCode())
|| ($dryRun && Response::HTTP_OK !== $res->getStatusCode())) { || ($dryRun && Response::HTTP_OK !== $res->getStatusCode())) {
throw new \Exception($res->toArray()['message']); throw new \HttpException($res->toArray()['message']);
} }
} }

View File

@ -25,6 +25,7 @@ use App\Repository\TldRepository;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Exception\ORMException; use Doctrine\ORM\Exception\ORMException;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\Exception\ClientException;
use Symfony\Component\HttpFoundation\Exception\BadRequestException; use Symfony\Component\HttpFoundation\Exception\BadRequestException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
@ -125,9 +126,10 @@ readonly class RDAPService
/** /**
* @throws TransportExceptionInterface * @throws TransportExceptionInterface
* @throws ServerExceptionInterface
* @throws RedirectionExceptionInterface
* @throws DecodingExceptionInterface * @throws DecodingExceptionInterface
* @throws HttpExceptionInterface * @throws ClientExceptionInterface
* @throws \Exception
*/ */
public function registerDomain(string $fqdn): Domain public function registerDomain(string $fqdn): Domain
{ {
@ -160,7 +162,7 @@ readonly class RDAPService
$res = $this->client->request( $res = $this->client->request(
'GET', $rdapServerUrl.'domain/'.$idnDomain 'GET', $rdapServerUrl.'domain/'.$idnDomain
)->toArray(); )->toArray();
} catch (HttpExceptionInterface $e) { } catch (ClientException $e) {
if (null !== $domain) { if (null !== $domain) {
$this->logger->notice('The domain name {idnDomain} has been deleted from the WHOIS database.', [ $this->logger->notice('The domain name {idnDomain} has been deleted from the WHOIS database.', [
'idnDomain' => $idnDomain, 'idnDomain' => $idnDomain,