diff options
author | Joas Schilling <coding@schilljs.com> | 2024-06-25 11:20:48 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-06-25 11:56:24 +0200 |
commit | 8130968a352bcf66606a076598fa4a58a291bc6d (patch) | |
tree | ed7d9c5bfc0d7e1b3c63348f0416d96cb51fb6ef /apps/files_reminders | |
parent | 9496ce6c7a35f5a6d151b78d78a45b1c900b3b2a (diff) | |
download | nextcloud-server-8130968a352bcf66606a076598fa4a58a291bc6d.tar.gz nextcloud-server-8130968a352bcf66606a076598fa4a58a291bc6d.zip |
feat(notifications): Migrate server INotifiers to new exceptions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files_reminders')
-rw-r--r-- | apps/files_reminders/lib/Notification/Notifier.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/apps/files_reminders/lib/Notification/Notifier.php b/apps/files_reminders/lib/Notification/Notifier.php index 7f0c2d69322..000b04119cd 100644 --- a/apps/files_reminders/lib/Notification/Notifier.php +++ b/apps/files_reminders/lib/Notification/Notifier.php @@ -9,16 +9,15 @@ declare(strict_types=1); namespace OCA\FilesReminders\Notification; -use InvalidArgumentException; use OCA\FilesReminders\AppInfo\Application; use OCP\Files\FileInfo; use OCP\Files\IRootFolder; use OCP\IURLGenerator; use OCP\L10N\IFactory; -use OCP\Notification\AlreadyProcessedException; use OCP\Notification\IAction; use OCP\Notification\INotification; use OCP\Notification\INotifier; +use OCP\Notification\UnknownNotificationException; class Notifier implements INotifier { public function __construct( @@ -37,14 +36,13 @@ class Notifier implements INotifier { } /** - * @throws InvalidArgumentException - * @throws AlreadyProcessedException + * @throws UnknownNotificationException */ public function prepare(INotification $notification, string $languageCode): INotification { $l = $this->l10nFactory->get(Application::APP_ID, $languageCode); if ($notification->getApp() !== Application::APP_ID) { - throw new InvalidArgumentException(); + throw new UnknownNotificationException(); } switch ($notification->getSubject()) { @@ -54,7 +52,7 @@ class Notifier implements INotifier { $node = $this->root->getUserFolder($notification->getUser())->getFirstNodeById($fileId); if (!$node) { - throw new InvalidArgumentException(); + throw new UnknownNotificationException(); } $path = rtrim($node->getPath(), '/'); @@ -92,8 +90,7 @@ class Notifier implements INotifier { $this->addActionButton($notification, $label); break; default: - throw new InvalidArgumentException(); - break; + throw new UnknownNotificationException(); } return $notification; |