Skip to content

fix: throw UnknownNotificationException for unknown notifications - #149

Merged
oleksandr-nc merged 1 commit into
mainfrom
fix/notifier-unknown-notification-exception
Sep 14, 2026
Merged

oleksandr-nc merged 1 commit into
mainfrom
fix/notifier-unknown-notification-exception

Conversation

@oleksandr-nc

Copy link
Copy Markdown
Contributor

Notifier::prepare() throws \InvalidArgumentException to signal a notification it does not know — both another app's notification and an unknown subject of its own. Since Nextcloud 30 the server treats that as deprecated and logs a warning for every such call:

OCA\Onedrive\Notification\Notifier::prepare() threw \InvalidArgumentException which is deprecated. Throw \OCP\Notification\UnknownNotificationException when the notification is not known to your notifier and otherwise handle all \InvalidArgumentException yourself.

Every registered notifier is asked to prepare every notification, so an instance with this app enabled writes one of these lines for each notification any other app sends.

Both throws now use OCP\Notification\UnknownNotificationException. It extends \InvalidArgumentException and has existed since Nextcloud 30, below this app's min-version of 33, so callers catching the old type are unaffected.

Same change as nextcloud/integration_jira#162, nextcloud/integration_github#202 and nextcloud/integration_openai#376.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Notifier::prepare() threw \InvalidArgumentException for a notification it
does not know, both for another app's notification and for an unknown
subject of its own. Since Nextcloud 30 the server logs a deprecation
warning for every such call, so an instance with this app enabled wrote
one line per notification any other app sent.

UnknownNotificationException extends \InvalidArgumentException and has
existed since Nextcloud 30, below the app's min-version of 33, so callers
catching the old type are unaffected.

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
@oleksandr-nc
oleksandr-nc merged commit 42becee into main Sep 14, 2026
17 of 18 checks passed
@oleksandr-nc
oleksandr-nc deleted the fix/notifier-unknown-notification-exception branch September 14, 2026 09:21
oleksandr-nc added a commit that referenced this pull request Sep 15, 2026
The notifier throws UnknownNotificationException since #149. It extends
InvalidArgumentException, so these assertions kept passing after the merge,
but they would also pass if the notifier went back to the deprecated
exception.

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
oleksandr-nc added a commit that referenced this pull request Sep 22, 2026
The notifier throws UnknownNotificationException since #149. It extends
InvalidArgumentException, so these assertions kept passing after the merge,
but they would also pass if the notifier went back to the deprecated
exception.

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant