scm_app: add more debug info when unhandled errors happen on vcsserver.

This commit is contained in:
Marcin Kuzminski 2018-09-26 12:11:09 +02:00
parent 98ef71f157
commit 5653c130c7
2 changed files with 8 additions and 2 deletions

View file

@ -245,7 +245,6 @@ def prepare_callback_daemon(extras, protocol, host, use_direct_calls, txn_id=Non
# register txn_id
extras['txn_id'] = txn_id
log.debug('Prepared a callback daemon: %s at url `%s`',
callback_daemon.__class__.__name__, callback_daemon.hooks_uri)
return callback_daemon, extras
@ -292,6 +291,9 @@ class Hooks(object):
try:
result = hook(extras)
if result is None:
raise Exception(
'Failed to obtain hook result from func: {}'.format(hook))
except HTTPBranchProtected as handled_error:
# Those special cases doesn't need error reporting. It's a case of
# locked repo or protected branch

View file

@ -114,13 +114,17 @@ class VcsHttpProxy(object):
stream=True)
log.debug('http-app: got vcsserver response: %s', response)
if response.status_code >= 500:
log.error('Exception returned by vcsserver at: %s %s, %s',
url, response.status_code, response.content)
# Preserve the headers of the response, except hop_by_hop ones
response_headers = [
(h, v) for h, v in response.headers.items()
if not wsgiref.util.is_hop_by_hop(h)
]
# Build status argument for start_reponse callable.
# Build status argument for start_response callable.
status = '{status_code} {reason_phrase}'.format(
status_code=response.status_code,
reason_phrase=response.reason)