# HG changeset patch # User Marcin Kuzminski # Date 2017-02-23 11:53:24 # Node ID cf13f14cb0ffc16ef9b2c514ea5558b4e1dfb981 # Parent 8e79c99b0cbef4cce1330460778a31a25f78160a exception-handling: propagate hooks tracebacks to vcsserver for easier debugging. diff --git a/rhodecode/lib/hooks_daemon.py b/rhodecode/lib/hooks_daemon.py --- a/rhodecode/lib/hooks_daemon.py +++ b/rhodecode/lib/hooks_daemon.py @@ -20,11 +20,10 @@ import json import logging -import urlparse +import traceback import threading from BaseHTTPServer import BaseHTTPRequestHandler from SocketServer import TCPServer -from routes.util import URLGenerator import pylons import rhodecode @@ -44,8 +43,10 @@ class HooksHttpHandler(BaseHTTPRequestHa try: result = self._call_hook(method, extras) except Exception as e: + exc_tb = traceback.format_exc() result = { 'exception': e.__class__.__name__, + 'exception_traceback': exc_tb, 'exception_args': e.args } self._write_response(result) @@ -214,12 +215,14 @@ class Hooks(object): try: result = hook(extras) except Exception as error: + exc_tb = traceback.format_exc() log.exception('Exception when handling hook %s', hook) error_args = error.args return { 'status': 128, 'output': '', 'exception': type(error).__name__, + 'exception_traceback': exc_tb, 'exception_args': error_args, } finally: