Skip to content

Commit

Permalink
Merge pull request buildbot#4907 from tardyp/github_reporter_erroring
Browse files Browse the repository at this point in the history
github: Fix error handling in case of bad interpolaters
  • Loading branch information
p12tic committed Jul 25, 2019
2 parents ce20a96 + b7c8e76 commit a862079
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
@@ -0,0 +1 @@
Fix Github error reporting to handle exceptions that happen before the http request is sent
9 changes: 7 additions & 2 deletions master/buildbot/reporters/github.py
Expand Up @@ -149,6 +149,7 @@ def send(self, build):

for sourcestamp in sourcestamps:
sha = sourcestamp['revision']
response = None
try:
repo_user = repoOwner
repo_name = repoName
Expand All @@ -174,15 +175,19 @@ def send(self, build):
state=state, repoOwner=repoOwner, repoName=repoName,
sha=sha, issue=issue, context=context))
except Exception as e:
content = yield response.content()
if response:
content = yield response.content()
code = response.code
else:
content = code = "n/a"
log.err(
e,
'Failed to update "{state}" for {repoOwner}/{repoName} '
'at {sha}, context "{context}", issue {issue}. '
'http {code}, {content}'.format(
state=state, repoOwner=repoOwner, repoName=repoName,
sha=sha, issue=issue, context=context,
code=response.code, content=content))
code=code, content=content))


class GitHubCommentPush(GitHubStatusPush):
Expand Down

0 comments on commit a862079

Please sign in to comment.