Skip to content

Commit 3f2eb76

Browse files
authored
Merge pull request #1466 from nextcloud/bugfix/noid/notification-handling
fix(notifications): Notifier::prepare() threw \InvalidArgumentExcepti…
2 parents 6bcc1e3 + 6796272 commit 3f2eb76

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/Notification/Notifier.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use OCP\Notification\IManager as INotificationManager;
1414
use OCP\Notification\INotification;
1515
use OCP\Notification\INotifier;
16+
use OCP\Notification\UnknownNotificationException;
1617
use OCP\User\Backend\ISetPasswordBackend;
1718

1819
class Notifier implements INotifier {
@@ -74,7 +75,7 @@ public function getName(): string {
7475
public function prepare(INotification $notification, string $languageCode): INotification {
7576
if ($notification->getApp() !== 'firstrunwizard') {
7677
// Not my app => throw
77-
throw new \InvalidArgumentException();
78+
throw new UnknownNotificationException();
7879
}
7980

8081
switch ($notification->getSubject()) {
@@ -83,7 +84,7 @@ public function prepare(INotification $notification, string $languageCode): INot
8384
if ($subject === '') {
8485
// Everything done, mark the notification as processed...
8586
$this->notificationManager->markProcessed($notification);
86-
throw new \InvalidArgumentException();
87+
throw new UnknownNotificationException();
8788
}
8889

8990
$notification->setParsedSubject($subject)
@@ -105,7 +106,7 @@ public function prepare(INotification $notification, string $languageCode): INot
105106
return $this->setAppHintDetails($notification, $languageCode, $app);
106107
default:
107108
// Unknown subject => Unknown notification => throw
108-
throw new \InvalidArgumentException();
109+
throw new UnknownNotificationException();
109110
}
110111
}
111112

0 commit comments

Comments
 (0)