Repository navigation
[16.0][FIX] sentry: apply sentry_ignore_exceptions to exceptions logged without exc_info - #3816
Open
Miftahussalam wants to merge 2 commits into
Open
Miftahussalam wants to merge 2 commits into
Miftahussalam wants to merge 2 commits into
Conversation
…hout exc_info before_send dropped the log records whose message is an exception (how Odoo logs UserError and AccessError in odoo/http.py: logger.warning(exc), no exc_info) by the fixed DEFAULT_IGNORED_EXCEPTIONS list, so sentry_ignore_exceptions had no effect on them: emptying the option did not let a ValidationError through. The same list of the configuration (ignore_errors of the client) is applied now, with the same matching as sentry_sdk does for an exc_info. Also fix the option name in the documentation: the code reads sentry_ignore_exceptions, the table said sentry_ignored_exceptions.
Contributor
|
Hi @versada, @moylop260, @naglis, @barsi, @fernandahf, |
Use the sentry_ignore_exceptions option directly instead of the client options, so that the check has no branch for a missing client or for classes, which the module never passes: the option is a list of names.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3815
before_senddropped the log records whose message is an exception by the fixedconst.DEFAULT_IGNORED_EXCEPTIONSlist. Odoo logs theUserErrorandAccessErrorof a request like that (_logger.warning(exc), noexc_info), sosentry_ignore_exceptionsdid not apply to them: emptying it did not let aValidationErrorthrough.The list of the configuration (
ignore_errorsof the client) is applied now, with the same matching assentry_sdkdoes for anexc_info(the full class name, or the class name). The default value of the option is the same list as before, so the default behaviour does not change.Also: the table of
readme/CONFIGURE.rstnamed the optionsentry_ignored_exceptions, the code readssentry_ignore_exceptions.Tests
test_capture_exceptions_with_no_exc_infoused to patch the constant; it setssentry_ignore_exceptionsempty now.test_ignore_exceptions_with_no_exc_info_from_config: withsentry_ignore_exceptions = odoo.exceptions.ValidationError, aValidationErroris ignored and aUserErroris captured.test_ignore_exceptions_with_no_exc_info(default list) still passes.The whole
sentrytest suite passes (16 tests, 0 failed). Without the change tohooks.py, the two tests above fail.This is for 16.0; the same code is in 17.0, 18.0 and 19.0, I can port it if the change is accepted.