Duplicate logging not needed for PEAR_Errors anymore #25953
Merged
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.
Overview
Unnecessary log entries.
Before
One example is the recent status check for db timezone support. Even though there's a try/catch it still logs it in the log.
Another I've seen is related to activities - there's a performance improvement that does a try/catch because the error is expected, but it still makes log entries (e.g. #18566 (comment))
After
If the exception is later caught, then it's up to that catching code to decide to log/rethrow, as it should be.
If it's not caught later, then it will get logged, as it should. So don't need to log it here.
One way to test this is just add a line like
CRM_Core_DAO::executeQuery('this is bad sql');
orPEAR::raiseError('boo');
in preprocess() on some form and then visit the form. You'll see it still logs the error.Technical Details
I vaguely remember a few years ago that PEAR errors weren't converted to exceptions, or something like that, so the logging might have been more needed.
Comments