Skip to content

Commit

Permalink
fix exception logging and respond to the request with the error
Browse files Browse the repository at this point in the history
  • Loading branch information
opalmer committed Jun 22, 2014
1 parent 4da0d5e commit 689f01c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions master/contrib/github_buildbot.py
Expand Up @@ -19,7 +19,7 @@
import sys
import traceback
from hashlib import sha1
from httplib import BAD_REQUEST
from httplib import BAD_REQUEST, INTERNAL_SERVER_ERROR
from optparse import OptionParser

from twisted.cred import credentials
Expand Down Expand Up @@ -111,10 +111,11 @@ def render_POST(self, request):
project = project[0]
logging.debug("Payload: " + str(payload))
self.process_change(payload, user, repo, repo_url, project)
except Exception:
logging.error("Encountered an exception:")
for msg in traceback.format_exception(*sys.exc_info()):
logging.error(msg.strip())

except Exception, e:
logging.exception(e)
request.setResponseCode(INTERNAL_SERVER_ERROR)
return json.dumps({"error": e.message})

def process_change(self, payload, user, repo, repo_url, project):
"""
Expand Down

0 comments on commit 689f01c

Please sign in to comment.