Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances error handling by printing detailed API error messages for various GitHub API exceptions, helping users diagnose and resolve issues.
- Capture exception objects as
eand delegate to a newprint_error_messageshelper. - Introduce
print_error_messagesto iterate through an exception’serrorslist and print each message. - Update all existing exception handlers in
search_issuesto callprint_error_messagesbefore exiting.
Comments suppressed due to low confidence (3)
search.py:92
- The error message is missing a closing apostrophe after the repository string. It should be
names: '{repos_and_owners_string}'to balance the quote.
f"The repository could not be found; \
search.py:123
- [nitpick] Loop variable
errorshadows the function parameter. Rename the loop variable to something likeerr_itemto avoid confusion.
for error in error.errors:
search.py:115
- The new helper function
print_error_messagesand its usage in handlers lack dedicated unit tests. Consider adding tests to verify that variouserrorspayloads are printed correctly.
def print_error_messages(error: github3.exceptions):
Signed-off-by: jmeridth <jmeridth@gmail.com> Co-authored-by: Zack Koppert <zkoppert@github.com>
2e2faec to
748a5f0
Compare
zkoppert
approved these changes
May 8, 2025
Collaborator
zkoppert
left a comment
There was a problem hiding this comment.
Really helpful addition!
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
Proposed Changes
Print api error messages so user's can solve problems
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,maintenance, orbreaking