-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Revert "refactor(RichObjectStrings): Only log error if key or value i… #52062
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
Conversation
…s not string in validator" This reverts commit fd156d3. Signed-off-by: Joas Schilling <coding@schilljs.com>
|
But throwing the exception is breaking a lot of things as well. Can you just downgrade it to debug, so it no longer spams on production instances? |
What is breaking, it is documented like that and 8 of 9 places calling the validation function catch the exception and change their behaviour based on it. |
👍 why should the correct behavior here be changed just be cause of some edge cases of faulty apps not following the documentation? Better to fix it instead in the apps than accepting the error (which again can lead to unexpected errors).. |
| foreach ($parameter as $key => $value) { | ||
| if (!is_string($key)) { | ||
| Server::get(LoggerInterface::class)->error('Object for placeholder ' . $placeholder . ' is invalid, key ' . $key . ' is not a string'); | ||
| throw new InvalidObjectExeption('Object for placeholder ' . $placeholder . ' is invalid, key ' . $key . ' is not a string'); |
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.
Can we on line 59 add mire context to the exception?
E.g. log the subject? Otherwise finding the origin is quite hard.
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.
Notifications is handling this properly already, catching the exception and logging an app+subject message instead:
server/lib/private/Notification/Manager.php
Lines 366 to 369 in ed6d76e
| if (!$notification->isValidParsed()) { | |
| $this->logger->info('Notification was not parsed by any notifier [app: ' . $notification->getApp() . ', subject: ' . $notification->getSubject() . ']'); | |
| throw new IncompleteParsedNotificationException(); | |
| } |
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.
- Improved the handling in the activity app the same way fix: Improving logging of invalid parameters for activity subject and… activity#1975
The problem is mainly the activity app, because its entries are generated by other apps and it's near impossible to figure out where the source of the error is without checking literally every instance in the code. See #51427 for example. |
|
Okay that should be covered by nextcloud/activity#1975 now |
…s not string in validator"
Checklist