diff --git a/lib/NotificationGenerator.php b/lib/NotificationGenerator.php index 9633964b9..e241a3fed 100644 --- a/lib/NotificationGenerator.php +++ b/lib/NotificationGenerator.php @@ -16,6 +16,7 @@ use OCP\Notification\IManager as NotificationManager; use OCP\Notification\INotification; use OCP\Notification\INotifier; +use OCP\Notification\UnknownNotificationException; use Psr\Log\LoggerInterface; class NotificationGenerator implements INotifier { @@ -101,7 +102,7 @@ public function getName(): string { public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getObjectType() !== 'activity_notification') { - throw new \InvalidArgumentException(); + throw new UnknownNotificationException(); } $event = $this->data->getById((int)$notification->getObjectId()); @@ -109,7 +110,7 @@ public function prepare(INotification $notification, string $languageCode): INot throw new AlreadyProcessedException(); } if ($event->getAffectedUser() !== $notification->getUser()) { - throw new \InvalidArgumentException(); + throw new AlreadyProcessedException(); } $this->activityManager->setCurrentUserId($notification->getUser()); $event = $this->populateEvent($event, $languageCode);