Skip to content

feat: pass through api error messages #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025

Conversation

jmeridth
Copy link
Member

@jmeridth jmeridth commented May 8, 2025

Pull Request

Proposed Changes

Print api error messages so user's can solve problems

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • run make lint and fix any issues that you have introduced
  • run make test and ensure you have test coverage for the lines you are introducing
  • If publishing new data to the public (scorecards, security scan results, code quality results, live dashboards, etc.), please request review from @jeffrey-luszcz

Reviewer

  • Label as either fix, documentation, enhancement, infrastructure, maintenance, or breaking

@jmeridth jmeridth self-assigned this May 8, 2025
@Copilot Copilot AI review requested due to automatic review settings May 8, 2025 21:27
@jmeridth jmeridth requested a review from a team as a code owner May 8, 2025 21:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 e and delegate to a new print_error_messages helper.
  • Introduce print_error_messages to iterate through an exception’s errors list and print each message.
  • Update all existing exception handlers in search_issues to call print_error_messages before 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 error shadows the function parameter. Rename the loop variable to something like err_item to avoid confusion.
for error in error.errors:

search.py:115

  • The new helper function print_error_messages and its usage in handlers lack dedicated unit tests. Consider adding tests to verify that various errors payloads are printed correctly.
def print_error_messages(error: github3.exceptions):

Signed-off-by: jmeridth <[email protected]>
Co-authored-by: Zack Koppert <[email protected]>
@jmeridth jmeridth force-pushed the jm_api_error_message_handling branch from 2e2faec to 748a5f0 Compare May 8, 2025 21:33
Copy link
Member

@zkoppert zkoppert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really helpful addition!

@zkoppert zkoppert merged commit 6a0f49b into main May 8, 2025
34 checks passed
@zkoppert zkoppert deleted the jm_api_error_message_handling branch May 8, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants