-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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): Improved notification exceptions #44770
Merged
nickvergessen
merged 6 commits into
master
from
techdebt/noid/improved-notification-exceptions
Apr 15, 2024
Merged
fix(notifications): Improved notification exceptions #44770
nickvergessen
merged 6 commits into
master
from
techdebt/noid/improved-notification-exceptions
Apr 15, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nickvergessen
added
2. developing
Work in progress
feature: activity and notification
technical debt
labels
Apr 10, 2024
nickvergessen
added
the
pending documentation
This pull request needs an associated documentation update
label
Apr 11, 2024
nickvergessen
force-pushed
the
techdebt/noid/improved-notification-exceptions
branch
from
April 11, 2024 12:56
a893719
to
02c7515
Compare
This was referenced Apr 11, 2024
nickvergessen
added
3. to review
Waiting for reviews
and removed
2. developing
Work in progress
labels
Apr 11, 2024
come-nc
reviewed
Apr 11, 2024
… set Signed-off-by: Joas Schilling <coding@schilljs.com>
nickvergessen
force-pushed
the
techdebt/noid/improved-notification-exceptions
branch
from
April 12, 2024 07:24
02c7515
to
f2b6025
Compare
… set while saving a notification Signed-off-by: Joas Schilling <coding@schilljs.com>
…s unknown to the notifier Signed-off-by: Joas Schilling <coding@schilljs.com>
… not parsed completely Signed-off-by: Joas Schilling <coding@schilljs.com>
…ager when it's done Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
nickvergessen
force-pushed
the
techdebt/noid/improved-notification-exceptions
branch
from
April 12, 2024 08:30
f2b6025
to
8745254
Compare
bigcat88
approved these changes
Apr 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
come-nc
approved these changes
Apr 15, 2024
nickvergessen
deleted the
techdebt/noid/improved-notification-exceptions
branch
April 15, 2024 07:26
3 tasks
nickvergessen
removed
the
pending documentation
This pull request needs an associated documentation update
label
Apr 17, 2024
4 tasks
4 tasks
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently all methods in the notification space throw
\InvalidArgumentException
s. The problem is that there are nested calls which make it impossible to handle errors correctly or to notify wrong/invalid notifiers properly.E.g. an app calls
INotification::setLink()
with an invalid value in it'sINotifier::prepare()
. TheINotification
will throw and it can go unnoticed by theINotifier
as it's not meant to throw. However theIManager
only sees thatINotifier
threw the exception and that is currently meant to be the case when theINotifier
does not want to handle theINotification
, so the IManager will think no one wanted to handle the notification although the respective one just had "an" error from any level. Similar problems often appear when activities are put into notifications as both providers work based on\InvalidArgumentException
so none of those knows whether activity or notifications was failing actually.This PR introduces dedicated exceptions which allow us to log them if they happened while not being expected. For the moment
\InvalidArgumentException
is still allowed to be thrown, and only logged on debug level, but thelib/private/Notification
will only throw the new exceptions (which all extend the generic\InvalidArgumentException
to keep compatibility.IncompleteNotificationException
- is thrown byIApp::notify
when a required field was not setIncompleteParsedNotificationException
- is thrown byINotifier::prepare
when it'sIManager
and a required field was not set during the renderingInvalidValueException
- is thrown byIAction::set*
andINotification::set*
when setting an invalid value (e.g. empty link, missing rich-object parameter, ...)UnknownNotificationException
- should be thrown byINotifier::prepare
when the notification is not handled by this notifierCompanion / Sample PRs
Checklist