Skip to content
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

Handle not found errors #4645

Merged
merged 1 commit into from
Feb 24, 2025
Merged

Handle not found errors #4645

merged 1 commit into from
Feb 24, 2025

Conversation

kenyonj
Copy link
Contributor

@kenyonj kenyonj commented Feb 24, 2025

Return nil when a repository is not found rather than raise an octokit error

Return `nil` when a repository is not found rather than raise an octokit error

Signed-off-by: Justin Kenyon <kenyonj@github.com>
@Copilot Copilot bot review requested due to automatic review settings February 24, 2025 17:33
@kenyonj kenyonj requested a review from a team as a code owner February 24, 2025 17:33

Choose a reason for hiding this comment

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

PR Overview

This PR updates the repository helper to gracefully handle cases when a repository is not found by returning nil instead of raising an exception.

  • Adds a rescue clause for Octokit::NotFound in test/test_helper.rb
  • Updates the repository method to assign nil for non-existent repositories

Reviewed Changes

File Description
test/test_helper.rb Adds error handling for Octokit::NotFound to return nil in tests

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

test/test_helper.rb:91

  • Ensure that tests are added to verify that the repository method returns nil when an Octokit::NotFound error is raised, to prevent potential regressions in error handling.
rescue Octokit::NotFound

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

@kenyonj kenyonj merged commit d168ab8 into main Feb 24, 2025
7 of 8 checks passed
@kenyonj kenyonj deleted the kenyonj-patch-1 branch February 24, 2025 17:45
@jmeridth jmeridth mentioned this pull request Feb 24, 2025
13 tasks
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