diff options
author | Anna Larch <anna@nextcloud.com> | 2024-09-16 15:09:39 +0200 |
---|---|---|
committer | Anna Larch <anna@nextcloud.com> | 2024-09-17 12:06:24 +0200 |
commit | 1ce46c1fca9797bb2bd5c160c5976eeec828ae32 (patch) | |
tree | 1a239cffc8f412e2ad1f5c637905f4acb119069d | |
parent | 4e64a6eb48dc5ba5bf3e31c1f58b1fcf710e255b (diff) | |
download | nextcloud-server-1ce46c1fca9797bb2bd5c160c5976eeec828ae32.tar.gz nextcloud-server-1ce46c1fca9797bb2bd5c160c5976eeec828ae32.zip |
refactor: move to new activity exceptionrefactor/move-to-new-activity-exception
Signed-off-by: Anna Larch <anna@nextcloud.com>
-rw-r--r-- | apps/comments/lib/Activity/Provider.php | 9 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Activity/Provider/Calendar.php | 7 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Activity/Provider/Event.php | 7 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Activity/Provider/Todo.php | 7 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php | 7 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/Activity/Provider/Card.php | 7 | ||||
-rw-r--r-- | apps/files/lib/Activity/FavoriteProvider.php | 5 | ||||
-rw-r--r-- | apps/files/lib/Activity/Provider.php | 5 | ||||
-rw-r--r-- | apps/files_sharing/lib/Activity/Providers/Base.php | 5 | ||||
-rw-r--r-- | apps/settings/lib/Activity/GroupProvider.php | 6 | ||||
-rw-r--r-- | apps/settings/lib/Activity/Provider.php | 7 | ||||
-rw-r--r-- | apps/settings/lib/Activity/SecurityProvider.php | 6 | ||||
-rw-r--r-- | apps/sharebymail/lib/Activity.php | 5 | ||||
-rw-r--r-- | apps/systemtags/lib/Activity/Provider.php | 5 | ||||
-rw-r--r-- | apps/twofactor_backupcodes/lib/Activity/Provider.php | 6 |
15 files changed, 53 insertions, 41 deletions
diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php index e537070a552..4fb0c8d58be 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -5,6 +5,7 @@ */ namespace OCA\Comments\Activity; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IManager; use OCP\Activity\IProvider; @@ -32,12 +33,12 @@ class Provider implements IProvider { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'comments') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('comments', $language); @@ -59,9 +60,9 @@ class Provider implements IProvider { } return $this->parseLongVersion($event); - } else { - throw new \InvalidArgumentException(); } + throw new UnknownActivityException(); + } /** diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php index a7509831f29..25d3260c7a6 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -5,6 +5,7 @@ */ namespace OCA\DAV\CalDAV\Activity\Provider; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IEventMerger; use OCP\Activity\IManager; @@ -59,12 +60,12 @@ class Calendar extends Base { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('dav', $language); @@ -122,7 +123,7 @@ class Calendar extends Base { } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_by') { $subject = $this->l->t('{actor} unshared calendar {calendar} from group {group}'); } else { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $parsedParameters = $this->getParameters($event); diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index 959c0a815dd..26bf69aecdd 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -6,6 +6,7 @@ namespace OCA\DAV\CalDAV\Activity\Provider; use OC_App; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IEventMerger; use OCP\Activity\IManager; @@ -106,12 +107,12 @@ class Event extends Base { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_event') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('dav', $language); @@ -147,7 +148,7 @@ class Event extends Base { } elseif ($event->getSubject() === self::SUBJECT_OBJECT_RESTORE . '_event_self') { $subject = $this->l->t('You restored event {event} of calendar {calendar}'); } else { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $parsedParameters = $this->getParameters($event); diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php index 68a95341ff2..1e817663439 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php @@ -5,6 +5,7 @@ */ namespace OCA\DAV\CalDAV\Activity\Provider; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; class Todo extends Event { @@ -14,12 +15,12 @@ class Todo extends Event { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('dav', $language); @@ -55,7 +56,7 @@ class Todo extends Event { } elseif ($event->getSubject() === self::SUBJECT_OBJECT_MOVE . '_todo_self') { $subject = $this->l->t('You moved to-do {todo} from list {sourceCalendar} to list {targetCalendar}'); } else { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $parsedParameters = $this->getParameters($event); diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php index 189c6a8e9ed..31f26554d67 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php @@ -8,6 +8,7 @@ declare(strict_types=1); */ namespace OCA\DAV\CardDAV\Activity\Provider; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IEventMerger; use OCP\Activity\IManager; @@ -52,11 +53,11 @@ class Addressbook extends Base { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'dav' || $event->getType() !== 'contacts') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $l = $this->languageFactory->get('dav', $language); @@ -102,7 +103,7 @@ class Addressbook extends Base { } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_by') { $subject = $l->t('{actor} unshared address book {addressbook} from group {group}'); } else { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $parsedParameters = $this->getParameters($event, $l); diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Card.php b/apps/dav/lib/CardDAV/Activity/Provider/Card.php index 7e8bf9b0d4d..aa821f592d9 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Card.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Card.php @@ -8,6 +8,7 @@ declare(strict_types=1); */ namespace OCA\DAV\CardDAV\Activity\Provider; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IEventMerger; use OCP\Activity\IManager; @@ -54,11 +55,11 @@ class Card extends Base { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'dav' || $event->getType() !== 'contacts') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $l = $this->languageFactory->get('dav', $language); @@ -82,7 +83,7 @@ class Card extends Base { } elseif ($event->getSubject() === self::SUBJECT_UPDATE . '_self') { $subject = $l->t('You updated contact {card} in address book {addressbook}'); } else { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $parsedParameters = $this->getParameters($event, $l); diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php index 00f1387df94..8cfc1a83798 100644 --- a/apps/files/lib/Activity/FavoriteProvider.php +++ b/apps/files/lib/Activity/FavoriteProvider.php @@ -5,6 +5,7 @@ */ namespace OCA\Files\Activity; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IEventMerger; use OCP\Activity\IManager; @@ -50,12 +51,12 @@ class FavoriteProvider implements IProvider { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'files' || $event->getType() !== 'favorite') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('files', $language); diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index aa3ef062a16..f777d11c02e 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -5,6 +5,7 @@ */ namespace OCA\Files\Activity; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IEventMerger; use OCP\Activity\IManager; @@ -79,12 +80,12 @@ class Provider implements IProvider { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'files') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('files', $language); diff --git a/apps/files_sharing/lib/Activity/Providers/Base.php b/apps/files_sharing/lib/Activity/Providers/Base.php index 5bf63b7e2af..13bf3fea0e7 100644 --- a/apps/files_sharing/lib/Activity/Providers/Base.php +++ b/apps/files_sharing/lib/Activity/Providers/Base.php @@ -5,6 +5,7 @@ */ namespace OCA\Files_Sharing\Activity\Providers; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IEventMerger; use OCP\Activity\IManager; @@ -65,12 +66,12 @@ abstract class Base implements IProvider { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'files_sharing') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('files_sharing', $language); diff --git a/apps/settings/lib/Activity/GroupProvider.php b/apps/settings/lib/Activity/GroupProvider.php index bad2c0c7a35..fc7189c774d 100644 --- a/apps/settings/lib/Activity/GroupProvider.php +++ b/apps/settings/lib/Activity/GroupProvider.php @@ -5,7 +5,7 @@ */ namespace OCA\Settings\Activity; -use InvalidArgumentException; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IManager; use OCP\Activity\IProvider; @@ -48,7 +48,7 @@ class GroupProvider implements IProvider { public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getType() !== 'group_settings') { - throw new InvalidArgumentException(); + throw new UnknownActivityException(); } $l = $this->l10n->get('settings', $language); @@ -95,7 +95,7 @@ class GroupProvider implements IProvider { } break; default: - throw new InvalidArgumentException(); + throw new UnknownActivityException(); } $this->setSubjects($event, $subject, $parsedParameters); diff --git a/apps/settings/lib/Activity/Provider.php b/apps/settings/lib/Activity/Provider.php index ab9a8e3c85c..8d726c8da22 100644 --- a/apps/settings/lib/Activity/Provider.php +++ b/apps/settings/lib/Activity/Provider.php @@ -8,6 +8,7 @@ declare(strict_types=1); */ namespace OCA\Settings\Activity; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IManager; use OCP\Activity\IProvider; @@ -60,12 +61,12 @@ class Provider implements IProvider { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'settings') { - throw new \InvalidArgumentException('Unknown app'); + throw new UnknownActivityException('Unknown app'); } $this->l = $this->languageFactory->get('settings', $language); @@ -105,7 +106,7 @@ class Provider implements IProvider { } elseif ($event->getSubject() === self::APP_TOKEN_FILESYSTEM_REVOKED) { $subject = $this->l->t('You revoked filesystem access from app password "{token}"'); } else { - throw new \InvalidArgumentException('Unknown subject'); + throw new UnknownActivityException('Unknown subject'); } $parsedParameters = $this->getParameters($event); diff --git a/apps/settings/lib/Activity/SecurityProvider.php b/apps/settings/lib/Activity/SecurityProvider.php index a67b9cf365e..8e2b4f8f45a 100644 --- a/apps/settings/lib/Activity/SecurityProvider.php +++ b/apps/settings/lib/Activity/SecurityProvider.php @@ -8,7 +8,7 @@ declare(strict_types=1); */ namespace OCA\Settings\Activity; -use InvalidArgumentException; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IManager; use OCP\Activity\IProvider; @@ -34,7 +34,7 @@ class SecurityProvider implements IProvider { public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getType() !== 'security') { - throw new InvalidArgumentException(); + throw new UnknownActivityException(); } $l = $this->l10n->get('settings', $language); @@ -85,7 +85,7 @@ class SecurityProvider implements IProvider { } break; default: - throw new InvalidArgumentException(); + throw new UnknownActivityException(); } return $event; } diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index bee75c48264..be9deeb7290 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -5,6 +5,7 @@ */ namespace OCA\ShareByMail; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IManager; use OCP\Activity\IProvider; @@ -62,12 +63,12 @@ class Activity implements IProvider { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'sharebymail') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('sharebymail', $language); diff --git a/apps/systemtags/lib/Activity/Provider.php b/apps/systemtags/lib/Activity/Provider.php index b3685990ffd..ba24dff31a8 100644 --- a/apps/systemtags/lib/Activity/Provider.php +++ b/apps/systemtags/lib/Activity/Provider.php @@ -5,6 +5,7 @@ */ namespace OCA\SystemTags\Activity; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IManager; use OCP\Activity\IProvider; @@ -54,12 +55,12 @@ class Provider implements IProvider { * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent - * @throws \InvalidArgumentException + * @throws UnknownActivityException * @since 11.0.0 */ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { if ($event->getApp() !== 'systemtags') { - throw new \InvalidArgumentException(); + throw new UnknownActivityException(); } $this->l = $this->languageFactory->get('systemtags', $language); diff --git a/apps/twofactor_backupcodes/lib/Activity/Provider.php b/apps/twofactor_backupcodes/lib/Activity/Provider.php index 567d2c4995c..7bf0db04e77 100644 --- a/apps/twofactor_backupcodes/lib/Activity/Provider.php +++ b/apps/twofactor_backupcodes/lib/Activity/Provider.php @@ -8,7 +8,7 @@ declare(strict_types=1); */ namespace OCA\TwoFactorBackupCodes\Activity; -use InvalidArgumentException; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\Activity\IEvent; use OCP\Activity\IManager; use OCP\Activity\IProvider; @@ -39,7 +39,7 @@ class Provider implements IProvider { public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'twofactor_backupcodes') { - throw new InvalidArgumentException(); + throw new UnknownActivityException(); } $l = $this->l10n->get('twofactor_backupcodes', $language); @@ -55,7 +55,7 @@ class Provider implements IProvider { } break; default: - throw new InvalidArgumentException(); + throw new UnknownActivityException(); } return $event; } |