Open
Description
Description
This issue tracks the refactoring of redundant exception logging instances throughout the codebase.
Problem
Several places in the codebase use redundant exception objects in logging.exception()
calls. Since logging.exception()
already automatically includes the exception traceback and message, passing the exception string explicitly is redundant.
Example:
except Exception as _cause: # pragma: no branch
_LOGGER.debug(str(type(_cause)))
_LOGGER.exception(str(_cause)) # Redundant - exception already included
_LOGGER.debug(str((_cause.args)))
Recommended Fix
Replace redundant exception logging with a descriptive message:
except Exception as _cause: # pragma: no branch
_LOGGER.debug(str(type(_cause)))
_LOGGER.exception("Exception occurred while processing") # Better
_LOGGER.debug(str((_cause.args)))
Or, if no additional context is needed:
except Exception as _cause: # pragma: no branch
_LOGGER.debug(str(type(_cause)))
_LOGGER.exception("") # Let the exception details speak for themselves
_LOGGER.debug(str((_cause.args)))
Files to Refactor
tests/__init__.py
: Line ~197- [Add additional instances found during implementation]
Related
- This issue was identified in PR Patch error style #385 (Patch error style #385 (comment))
Metadata
Metadata
Assignees
Type
Projects
Status
To do