Skip to content

Commit

Permalink
Improve logging on GitHub API errors (#1408)
Browse files Browse the repository at this point in the history
  • Loading branch information
singiamtel authored Oct 18, 2024
1 parent 122d6fa commit 655887d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions alibot_helpers/github_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ def post(self, url, data, stable_api=True, **kwds):
data = json.dumps(data) if type(data) == dict else data
response = requests.post(url=url, data=data, headers=headers)
sc = response.status_code
if sc == 422:
print(f"GitHub error: Unprocessable Entity", file=sys.stderr)
return sc

@trace
Expand Down
4 changes: 2 additions & 2 deletions report-pr-errors
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def get_pending_namespace(args):
url="")


def handle_branch(cgh, pr, logs, args):
def handle_branch(cgh: GithubCachedClient, pr, logs, args):
ns = get_pending_namespace(args) if args.pending else \
Namespace(commit=args.pr,
status=args.status + "/error",
Expand All @@ -477,7 +477,7 @@ def handle_branch(cgh, pr, logs, args):
sys.exit(0)


def handle_pr_id(cgh, pr, logs, args):
def handle_pr_id(cgh: GithubCachedClient, pr, logs, args):
commit = cgh.get("/repos/{repo_name}/commits/{ref}",
repo_name=pr.repo_name,
ref=pr.commit)
Expand Down

0 comments on commit 655887d

Please sign in to comment.