Skip to content

Commit

Permalink
fix(notifications): Notifier::prepare() threw \InvalidArgumentExcepti…
Browse files Browse the repository at this point in the history
…on which is deprecated

Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Dec 20, 2024
1 parent 298a347 commit 37a2365
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCP\L10N\IFactory;
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
use OCP\Notification\UnknownNotificationException;

class Notifier implements INotifier {
private IFactory $factory;
Expand Down Expand Up @@ -41,7 +42,7 @@ public function getName(): string {
public function prepare(INotification $notification, string $languageCode): INotification {
if ($notification->getApp() !== Application::APP_ID) {
// Not my app => throw
throw new \InvalidArgumentException();
throw new UnknownNotificationException();

Check warning on line 45 in lib/Notification/Notifier.php

View check run for this annotation

Codecov / codecov/patch

lib/Notification/Notifier.php#L45

Added line #L45 was not covered by tests
}

// Read the language from the notification
Expand Down Expand Up @@ -69,7 +70,7 @@ public function prepare(INotification $notification, string $languageCode): INot
]);
break;
default:
throw new \InvalidArgumentException();
throw new UnknownNotificationException();

Check warning on line 73 in lib/Notification/Notifier.php

View check run for this annotation

Codecov / codecov/patch

lib/Notification/Notifier.php#L73

Added line #L73 was not covered by tests
}

return $notification;
Expand Down

0 comments on commit 37a2365

Please sign in to comment.