diff --git a/master/buildbot/newsfragments/github_reporter_erroring.bugfix b/master/buildbot/newsfragments/github_reporter_erroring.bugfix new file mode 100644 index 00000000000..45afc9c399e --- /dev/null +++ b/master/buildbot/newsfragments/github_reporter_erroring.bugfix @@ -0,0 +1 @@ +Fix Github error reporting to handle exceptions that happen before the http request is sent diff --git a/master/buildbot/reporters/github.py b/master/buildbot/reporters/github.py index d47418d3f77..9abf350f4ab 100644 --- a/master/buildbot/reporters/github.py +++ b/master/buildbot/reporters/github.py @@ -149,6 +149,7 @@ def send(self, build): for sourcestamp in sourcestamps: sha = sourcestamp['revision'] + response = None try: repo_user = repoOwner repo_name = repoName @@ -174,7 +175,11 @@ 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} ' @@ -182,7 +187,7 @@ def send(self, build): '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):