Skip to content

Commit f4f194b

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: [Notifier] [5.3] Make sure Http TransportException is not leaking
2 parents 0ab0b3f + 0ebd9f0 commit f4f194b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

GatewayApiTransport.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Notifier\Message\SmsMessage;
1919
use Symfony\Component\Notifier\Transport\AbstractTransport;
2020
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
21+
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
2122
use Symfony\Contracts\HttpClient\HttpClientInterface;
2223

2324
/**
@@ -65,7 +66,12 @@ protected function doSend(MessageInterface $message): SentMessage
6566
],
6667
]);
6768

68-
$statusCode = $response->getStatusCode();
69+
try {
70+
$statusCode = $response->getStatusCode();
71+
} catch (TransportExceptionInterface $e) {
72+
throw new TransportException('Could not reach the remote GatewayApi server.', $response, 0, $e);
73+
}
74+
6975
if (200 !== $statusCode) {
7076
throw new TransportException(sprintf('Unable to send the SMS: error %d.', $statusCode), $response);
7177
}

0 commit comments

Comments
 (0)