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 cases #80

Merged
merged 1 commit into from
Feb 6, 2021
Merged

Handle not found cases #80

merged 1 commit into from
Feb 6, 2021

Conversation

coni2k
Copy link
Contributor

@coni2k coni2k commented Feb 6, 2021

I was looking into whether we can improve handling "deleted/non-existing repos" cases:

  • It shows a "Repo not found" message, instead of the exception
  • In "generate" script, if the repo is not found, it doesn't continue with the retries

Current output for GitHub in "not found" case:

Traceback (most recent call last):
  File "..\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "..\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "..\criticality_score\criticality_score\run.py", line 584, in <module>
    main()
  File "..\criticality_score\criticality_score\run.py", line 564, in main
    repo = get_repository(args.repo)
  File "..\criticality_score\criticality_score\run.py", line 526, in get_repository
    repo = get_github_auth_token().get_repo(repo_url)
  File "..\Python39\lib\site-packages\github\MainClass.py", line 345, in get_repo
    headers, data = self.__requester.requestJsonAndCheck(
  File "..\Python39\lib\site-packages\github\Requester.py", line 315, in requestJsonAndCheck
    return self.__check(
  File "..\Python39\lib\site-packages\github\Requester.py", line 340, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest/reference/repos#get-a-repository"}

New output:

Repo not found: https://github.com/x/x

Copy link
Contributor

@inferno-chromium inferno-chromium left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@inferno-chromium inferno-chromium merged commit 364a197 into ossf:main Feb 6, 2021
@coni2k coni2k deleted the not-found branch February 7, 2021 08:51
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.

None yet

2 participants