fix: comment when an empty except occurs explaining why no action is taken#374
Merged
fix: comment when an empty except occurs explaining why no action is taken#374
Conversation
…taken Signed-off-by: Zack Koppert <zkoppert@github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds explanatory comments to empty except blocks that handle github3.exceptions.NotFoundError to clarify why no action is taken when files are not found. The changes improve code readability by documenting the intentional behavior of continuing execution when optional files are missing.
- Adds consistent explanatory comments to four empty except blocks
- Clarifies that missing files are treated as non-critical and execution should continue
- Improves code maintainability by documenting the reasoning behind empty exception handlers
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| evergreen.py | Added comment explaining why NotFoundError is ignored in check_existing_config function |
| dependabot_file.py | Added identical explanatory comments to three separate NotFoundError exception handlers in build_dependabot_file function |
jmeridth
approved these changes
Jul 7, 2025
Contributor
jmeridth
left a comment
There was a problem hiding this comment.
LGTM. Maybe in future we create another error type that inherits from this type that is explicitly named?
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.
Pull Request
This pull request includes updates to error handling in the
dependabot_file.pyandevergreen.pyfiles. The changes clarify that missing files are handled properly, are not errors, and we shouldn't create unnecessary logging unnecessary messages.Proposed Changes
Error handling improvements:
dependabot_file.py: Updated thebuild_dependabot_filefunction to handlegithub3.exceptions.NotFoundErrorby continuing to the next file when a required file is missing, avoiding error raising or logging. This change is repeated in three different parts of the function. [1] [2] [3]evergreen.py: Updated thecheck_existing_configfunction to handlegithub3.exceptions.NotFoundErrorsimilarly, ensuring that missing files are treated as non-critical and returningNoneinstead of raising errors.Readiness Checklist
Author/Contributor
make lintand fix any issues that you have introducedmake testand ensure you have test coverage for the lines you are introducing@jeffrey-luszczReviewer
fix,documentation,enhancement,infrastructure,maintenanceorbreakingThis pull request introduces consistent handling for cases where a required file is not found in the repository. Instead of raising errors or logging, the code now explicitly continues to the next file, ensuring smoother execution in scenarios where certain files are optional.