Skip to content

Commit 26f2929

Browse files
Merge pull request #249 from nextcloud/bugfix/noid/notification-handling
fix(notifications): Notifier::prepare() threw \InvalidArgumentExcepti…
2 parents 0ecb7ce + 88bab3f commit 26f2929

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/Notification/Notifier.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111

1212
namespace OCA\Approval\Notification;
1313

14-
use InvalidArgumentException;
1514
use OCA\Approval\AppInfo\Application;
1615
use OCP\IURLGenerator;
1716
use OCP\IUser;
1817
use OCP\IUserManager;
1918
use OCP\L10N\IFactory;
2019
use OCP\Notification\INotification;
21-
2220
use OCP\Notification\INotifier;
21+
use OCP\Notification\UnknownNotificationException;
2322

2423
class Notifier implements INotifier {
2524

@@ -53,13 +52,13 @@ public function getName(): string {
5352
* @param INotification $notification
5453
* @param string $languageCode The code of the language that should be used to prepare the notification
5554
* @return INotification
56-
* @throws InvalidArgumentException When the notification was not prepared by a notifier
55+
* @throws UnknownNotificationException When the notification was not prepared by a notifier
5756
* @since 9.0.0
5857
*/
5958
public function prepare(INotification $notification, string $languageCode): INotification {
6059
if ($notification->getApp() !== Application::APP_ID) {
6160
// Not my app => throw
62-
throw new InvalidArgumentException();
61+
throw new UnknownNotificationException();
6362
}
6463

6564
$l = $this->factory->get(Application::APP_ID, $languageCode);
@@ -163,7 +162,7 @@ public function prepare(INotification $notification, string $languageCode): INot
163162

164163
default:
165164
// Unknown subject => Unknown notification => throw
166-
throw new InvalidArgumentException();
165+
throw new UnknownNotificationException();
167166
}
168167
}
169168
}

0 commit comments

Comments
 (0)