Repository navigation
fix: Combine logger exception/warning messages - #721
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces duplicate exception logging by consolidating paired logger.error/logger.warning + logger.exception calls into single exception-aware log calls, and removes redundant exception string interpolation where exc_info is already emitted.
Changes:
- Replaced redundant two-line exception logging patterns with single
logger.exception(...)calls across several modules. - Removed redundant
{e=}inclusion in a connection error message whereexc_info=Trueis already provided. - Adjusted a CLI FUSE mount error handler to log via a single
logger.exception(...)call.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| aperturedb/VideoDataCSV.py | Consolidates duplicate error + exception logging for video load failures. |
| aperturedb/Sources.py | Consolidates validation error logging in file load exception handler. |
| aperturedb/ImageDownloader.py | Consolidates image download/decode exception logging (notably for GET connection failures). |
| aperturedb/ImageDataCSV.py | Consolidates duplicate error + exception logging for image load failures. |
| aperturedb/Connector.py | Removes redundant exception interpolation from a connection error log while keeping exc_info=True. |
| aperturedb/cli/mount_coco.py | Consolidates exception logging in FUSE read path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (2)
aperturedb/ImageDownloader.py:113
requests.exceptions.ConnectionErroris caught asebut the variable is unused. Consider switching toexcept requests.exceptions.ConnectionError:since you’re logging withexc_info=Truealready.
except requests.exceptions.ConnectionError as e:
logger.warning("Error with GET.", exc_info=True)
aperturedb/ImageDownloader.py:138
- The exception is captured as
ebut not used after switching tologger.exception(...). Consider changing this toexcept Exception:.
except Exception as e:
logger.exception(f"Downloaded image cannot be decoded: {url}")
os.remove(filename)
self.error_counter += 1
luisremis
approved these changes
May 21, 2026
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.
Summary
This PR combines redundant logger calls in exception handlers into single
logger.exceptioncalls, avoiding duplicate exception logging. It also removes the redundant{e=}inside format strings whereexc_info=Trueis already provided.Verification
Checked that the syntax is correct and logs the exception alongside the error message without duplicating the exception trace or object string.
Fixes #408