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

Fix error handling #1347

Closed
wants to merge 1 commit into from
Closed

Conversation

leofang
Copy link
Member

@leofang leofang commented Jan 26, 2025

Try this to see if #1346 can be fixed. I can reproduce the error locally and I noticed that despite it's a 404 error, pygithub does not raise github.UnknownObjectException as documented, but instead raises the base github.GithubtException. Something might have changed in recent pygithub versions. I tested this with 2.4.0.

Let's try to merge this and see if it fixes 1346.

@leofang leofang requested a review from a team as a code owner January 26, 2025 02:57
@leofang leofang force-pushed the fix_error_handling branch from cd567c0 to 08b575f Compare January 26, 2025 02:58
@leofang leofang closed this Jan 26, 2025
@leofang leofang force-pushed the fix_error_handling branch from 08b575f to d7bd500 Compare January 26, 2025 03:00
@leofang
Copy link
Member Author

leofang commented Jan 26, 2025

urgh, github closed my PR while I was fixing a dirty rebase...

@leofang leofang reopened this Jan 26, 2025
@leofang
Copy link
Member Author

leofang commented Jan 26, 2025

PTAL

@leofang
Copy link
Member Author

leofang commented Jan 26, 2025

Seems like a known bug in pygithub: PyGithub/PyGithub#3179

Copy link
Member

@beckermr beckermr left a comment

Choose a reason for hiding this comment

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

This fix is too generic. I'll push the correct code later.

@leofang
Copy link
Member Author

leofang commented Jan 26, 2025

Thanks, Matt. The upstream is working on a fix (PyGithub/PyGithub#3180) so I was hoping to quickly work around this and revert it once a new release is out. But if you have time to refine it I am also happy 🙏

@leofang
Copy link
Member Author

leofang commented Jan 26, 2025

Are you thinking of checking e.status == 404 and "No object found for the path" in e.message when catching github.GithubException?

@beckermr
Copy link
Member

yes see #1348

@beckermr beckermr closed this Jan 26, 2025
@leofang leofang deleted the fix_error_handling branch January 26, 2025 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants