Closed MagicLegend closed 7 months ago
Hey good news! The latest release actually added good support to be able to ignore or change errors using more advanced behaviour. See: https://github.com/justbetter/magento2-sentry#change--filter-events
As we are of the opinion that different ways of implementing this are slightly out of scope for this module, as everyone wants different rules and different ways of checking these we are actually working on an addon module to this Sentry package to filter out events based on messages to be ignored entered in the Admin, as well as remove localisation when possible:
https://github.com/justbetter/magento2-sentry-filter-events/ https://github.com/justbetter/magento2-sentry-filter-events/blob/master/Observer/BeforeSending.php
Maybe you can use that outright, or maybe use it as inspiration to ignore the exception based on rules you set 🙂
Hey,
That's great news! Very glad to see you already recognized this issue with the add-in module :-) I think that the used str_contains
function already covers most bases, although maybe a bit finer control might be desired (i.e. only if exception type X and string type Y match).
Given that these settings are in the adminpanel; are you considering moving the settings of the main module there as well?
Thanks for your time!
While we've always had the stance that only a developer with sufficient access and technical knowledge should be able to change these settings as misconfiguration could break things, we cannot avoid it for Adobe Cloud https://github.com/justbetter/magento2-sentry/issues/80
So most basic settings are able to be set up from the Magento admin panel, but extremely error prone and breaking configuration can only be set up via the database, config.php, env.php or environment variables
Do you want to request a feature or report a bug?
What is the current behavior?
You can only ignore exceptions by class.
What is the expected behavior?
Additionally be able to ignore exceptions by matching the message with a regex.
What is your use case for such a feature?
Magento has a couple of exceptions that I don't care about. For example, https://github.com/magento/magento2/blob/adc4105fcfbeee29d534482d8c6d9c5c1a193a0c/app/code/Magento/Customer/Model/CustomerRegistry.php#L88. But, I don't want to fully ignore
NoSuchEntityException
.This will of course introduce a performance panalty, so only simple regexes should be preferred. In my opinion straight up string comparisons are less useful, since they will be restrictive in some edge-cases.
Another option might be to be able to ignore by error code on a per-class basis.
What is your proposed configuration entry? The new option to add? What is the behavior?
The coolest solution would be if the
ignore_exceptions
array supports both, but easier would be to just have a second array of regexes to also make a clearer distinction between where the classes should be entered vs where regex should be entered.What is the version of Magento and of Sentry extension you are using? Always use the latest version of the extension one before opening a bug issue.
Not applicable.