Skip to content

Conversation

Copy link

Copilot AI commented Nov 17, 2025

Summary

Adds json.JSONDecodeError handling when loading GitHub contributor data. Previously, malformed JSON would cause an unhandled exception instead of a helpful error message.

try:
    with open(github_data_file, 'r') as f:
        contributors_data = json.load(f)
except FileNotFoundError:
    # existing handler
except json.JSONDecodeError as e:
    print(f"Error: Invalid JSON in {github_data_file}")
    print(f"Details: {e}")
    print("Please ensure the file contains valid JSON from the GitHub API.")
    sys.exit(1)

Type of Change

  • Bug fix
  • Code quality

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Tested with malformed JSON, valid empty JSON, and missing file scenarios. All error paths produce appropriate messages.

Related Issues

Relates to #5776
Discussion: #5776 (comment)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: taniandjerry <126204004+taniandjerry@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on Community Stars analysis script Add JSON error handling to community_stars.py Nov 17, 2025
Copilot AI requested a review from taniandjerry November 17, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants