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

github: Fix error handling in case of bad interpolaters #4907

Merged
merged 1 commit into from Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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