From 0d0c2cdaa08f6bc8f547b437a5b046914680b3f5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 Apr 2024 17:12:31 +0200 Subject: fix(notifications): Add a dedicated exception when a notification was not parsed completely Signed-off-by: Joas Schilling --- lib/private/Notification/Manager.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/private/Notification') diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index 63374cea21f..df9d338beb0 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -36,6 +36,7 @@ use OCP\Notification\IDeferrableApp; use OCP\Notification\IDismissableNotifier; use OCP\Notification\IManager; use OCP\Notification\IncompleteNotificationException; +use OCP\Notification\IncompleteParsedNotificationException; use OCP\Notification\INotification; use OCP\Notification\INotifier; use OCP\Notification\UnknownNotificationException; @@ -365,13 +366,14 @@ class Manager implements IManager { } if (!$notification->isValidParsed()) { - throw new \InvalidArgumentException('The given notification has not been handled'); + $this->logger->info('Notification was claimed to be parsed, but was not fully parsed by ' . get_class($notifier) . ' [app: ' . $notification->getApp() . ', subject: ' . $notification->getSubject() . ']'); + throw new IncompleteParsedNotificationException(); } } if (!$notification->isValidParsed()) { $this->logger->info('Notification was not parsed by any notifier [app: ' . $notification->getApp() . ', subject: ' . $notification->getSubject() . ']'); - throw new \InvalidArgumentException('The given notification has not been handled'); + throw new IncompleteParsedNotificationException(); } return $notification; -- cgit v1.2.3