Skip to content

Commit fb13001

Browse files
NyholmOskarStark
authored andcommitted
[Notifier] [5.3] Make sure Http TransportException is not leaking
1 parent 97afe82 commit fb13001

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ClickatellTransport.php

Lines changed: 8 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
/**
@@ -74,7 +75,13 @@ protected function doSend(MessageInterface $message): SentMessage
7475
],
7576
]);
7677

77-
if (202 === $response->getStatusCode()) {
78+
try {
79+
$statusCode = $response->getStatusCode();
80+
} catch (TransportExceptionInterface $e) {
81+
throw new TransportException('Could not reach the remote Clicktell server.', $response, 0, $e);
82+
}
83+
84+
if (202 === $statusCode) {
7885
$result = $response->toArray();
7986
$sentMessage = new SentMessage($message, (string) $this);
8087
$sentMessage->setMessageId($result['data']['message'][0]['apiMessageId']);

0 commit comments

Comments
 (0)