Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(notifications): Notifier::prepare() threw \InvalidArgumentExcepti… #416

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OCP\Notification\IAction;
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
use OCP\Notification\UnknownNotificationException;

class Notifier implements INotifier {
public const SUBJECT = 'announced';
Expand Down Expand Up @@ -64,12 +65,12 @@ public function getName(): string {
* @param INotification $notification
* @param string $languageCode The code of the language that should be used to prepare the notification
* @return INotification
* @throws \InvalidArgumentException When the notification was not prepared by a notifier
* @throws UnknownNotificationException When the notification was not prepared by a notifier
*/
public function prepare(INotification $notification, string $languageCode): INotification {
if ($notification->getApp() !== $this->appName) {
// Not my app => throw
throw new \InvalidArgumentException();
throw new UnknownNotificationException();
}

// Read the language from the notification
Expand Down Expand Up @@ -108,7 +109,7 @@ public function prepare(INotification $notification, string $languageCode): INot

default:
// Unknown subject => Unknown notification => throw
throw new \InvalidArgumentException();
throw new UnknownNotificationException();
}
}
}
Loading