diff options
Diffstat (limited to 'lib/public/Activity/Exceptions')
5 files changed, 136 insertions, 0 deletions
diff --git a/lib/public/Activity/Exceptions/FilterNotFoundException.php b/lib/public/Activity/Exceptions/FilterNotFoundException.php new file mode 100644 index 00000000000..e3461f9b3e3 --- /dev/null +++ b/lib/public/Activity/Exceptions/FilterNotFoundException.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\Activity\Exceptions; + +/** + * @since 30.0.0 + */ +class FilterNotFoundException extends \InvalidArgumentException { + /** + * @since 30.0.0 + */ + public function __construct( + protected string $filter, + ) { + parent::__construct('Filter ' . $filter . ' not found'); + } + + /** + * @since 30.0.0 + */ + public function getFilterId(): string { + return $this->filter; + } +} diff --git a/lib/public/Activity/Exceptions/IncompleteActivityException.php b/lib/public/Activity/Exceptions/IncompleteActivityException.php new file mode 100644 index 00000000000..44f6b4aba58 --- /dev/null +++ b/lib/public/Activity/Exceptions/IncompleteActivityException.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\Activity\Exceptions; + +/** + * Thrown when {@see \OCP\Notification\IManager::notify()} is called with a notification + * that does not have all required fields set: + * + * - app + * - type + * - affectedUser + * - subject + * - objectType + * - objectId + * + * @since 30.0.0 + */ +class IncompleteActivityException extends \BadMethodCallException { +} diff --git a/lib/public/Activity/Exceptions/InvalidValueException.php b/lib/public/Activity/Exceptions/InvalidValueException.php new file mode 100644 index 00000000000..aa4b04ab199 --- /dev/null +++ b/lib/public/Activity/Exceptions/InvalidValueException.php @@ -0,0 +1,32 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\Activity\Exceptions; + +/** + * @since 30.0.0 + */ +class InvalidValueException extends \InvalidArgumentException { + /** + * @since 30.0.0 + */ + public function __construct( + protected string $field, + ?\Throwable $previous = null, + ) { + parent::__construct('Value provided for ' . $field . ' is not valid', previous: $previous); + } + + /** + * @since 30.0.0 + */ + public function getFieldIdentifier(): string { + return $this->field; + } +} diff --git a/lib/public/Activity/Exceptions/SettingNotFoundException.php b/lib/public/Activity/Exceptions/SettingNotFoundException.php new file mode 100644 index 00000000000..d0847c19cd2 --- /dev/null +++ b/lib/public/Activity/Exceptions/SettingNotFoundException.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\Activity\Exceptions; + +/** + * @since 30.0.0 + */ +class SettingNotFoundException extends \InvalidArgumentException { + /** + * @since 30.0.0 + */ + public function __construct( + protected string $setting, + ) { + parent::__construct('Setting ' . $setting . ' not found'); + } + + /** + * @since 30.0.0 + */ + public function getSettingId(): string { + return $this->setting; + } +} diff --git a/lib/public/Activity/Exceptions/UnknownActivityException.php b/lib/public/Activity/Exceptions/UnknownActivityException.php new file mode 100644 index 00000000000..5567ddf2534 --- /dev/null +++ b/lib/public/Activity/Exceptions/UnknownActivityException.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\Activity\Exceptions; + +/** + * @since 30.0.0 + */ +class UnknownActivityException extends \InvalidArgumentException { +} |