diff --git a/lib/NotificationGenerator.php b/lib/NotificationGenerator.php index 99e3e3b70..367cbc16b 100644 --- a/lib/NotificationGenerator.php +++ b/lib/NotificationGenerator.php @@ -118,7 +118,12 @@ public function prepare(INotification $notification, string $languageCode): INot $event = $this->populateEvent($event, $languageCode); $this->activityManager->setCurrentUserId(null); - return $this->getDisplayNotificationForEvent($event, $event->getObjectId()); + try { + return $this->getDisplayNotificationForEvent($event, $event->getObjectId()); + } catch (\InvalidArgumentException $e) { + $this->logger->error('Failed to format activity notification', ['exception' => $e]); + throw new AlreadyProcessedException(); + } } private function getDisplayNotificationForEvent(IEvent $event, int $activityId): INotification {