diff --git a/src/Appwrite/Deletes/Targets.php b/src/Appwrite/Deletes/Targets.php index 794ab0b87a..5ba667d823 100644 --- a/src/Appwrite/Deletes/Targets.php +++ b/src/Appwrite/Deletes/Targets.php @@ -3,8 +3,10 @@ namespace Appwrite\Deletes; use Appwrite\Extend\Exception; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Limit as LimitException; use Utopia\Database\Query; class Targets @@ -42,12 +44,17 @@ class Targets MESSAGE_TYPE_PUSH => 'pushTotal', default => throw new Exception('Invalid target provider type'), }; - $database->decreaseDocumentAttribute( - 'topics', - $topicId, - $totalAttribute, - min: 0 - ); + + try { + $database->decreaseDocumentAttribute( + 'topics', + $topicId, + $totalAttribute, + min: 0 + ); + } catch (LimitException $e) { + Console::error("Delete subscribers decreaseDocumentAttribute (topicId={$topicId}): {$e->getMessage()}"); + } } } );