Skip to content

Commit 2b3eca8

Browse files
committed
improve handling of HTTP 410 'Gone' exception
1 parent eb731d4 commit 2b3eca8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ConnectionRepository.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Aws\ApiGatewayManagementApi\ApiGatewayManagementApiClient;
66
use Aws\ApiGatewayManagementApi\Exception\ApiGatewayManagementApiException;
7+
use Symfony\Component\HttpFoundation\Response;
78

89
class ConnectionRepository
910
{
@@ -30,8 +31,11 @@ public function sendMessage(string $connectionId, string $data): void
3031
'Data' => $data,
3132
]);
3233
} catch (ApiGatewayManagementApiException $e) {
33-
// GoneException: The connection with the provided id no longer exists.
34-
if ($e->getAwsErrorCode() === 'GoneException') {
34+
// GoneException: The connection with the provided id no longer exists
35+
if (
36+
$e->getStatusCode() === Response::HTTP_GONE ||
37+
$e->getAwsErrorCode() === 'GoneException'
38+
) {
3539
$this->subscriptionRepository->clearConnection($connectionId);
3640

3741
return;

0 commit comments

Comments
 (0)