From 01d6e2e483da884afe2cdc4d7ec61b3d5a3ab69f Mon Sep 17 00:00:00 2001 From: Richan Fongdasen Date: Tue, 9 Nov 2021 22:51:15 +0700 Subject: [PATCH] Avoid throwing exception, using abort() instead --- src/GcrPubSubQueue.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/GcrPubSubQueue.php b/src/GcrPubSubQueue.php index f32166f..e8d2619 100644 --- a/src/GcrPubSubQueue.php +++ b/src/GcrPubSubQueue.php @@ -2,7 +2,6 @@ namespace RichanFongdasen\GCRWorker; -use ErrorException; use Google\Cloud\PubSub\Message; use Kainxspirits\PubSubQueue\Connectors\PubSubConnector; use RichanFongdasen\GCRWorker\Concerns\CreatesPubSubQueue; @@ -39,8 +38,6 @@ public function acknowledge(Message $message): void * * @param Message $original * - * @throws ErrorException - * * @return Message */ public function pullFreshMessage(Message $original): Message @@ -59,6 +56,6 @@ public function pullFreshMessage(Message $original): Message } } - throw new ErrorException(sprintf('Failed to pull a PubSub message with id "%s"', $original->id())); + abort(409, sprintf('Failed to pull a PubSub message with id "%s"', $original->id())); } }