##// END OF EJS Templates
exception-handling: propagate hooks tracebacks to vcsserver for easier debugging.
marcink -
r1458:cf13f14c default
parent child Browse files
Show More
@@ -20,11 +20,10 b''
20
20
21 import json
21 import json
22 import logging
22 import logging
23 import urlparse
23 import traceback
24 import threading
24 import threading
25 from BaseHTTPServer import BaseHTTPRequestHandler
25 from BaseHTTPServer import BaseHTTPRequestHandler
26 from SocketServer import TCPServer
26 from SocketServer import TCPServer
27 from routes.util import URLGenerator
28
27
29 import pylons
28 import pylons
30 import rhodecode
29 import rhodecode
@@ -44,8 +43,10 b' class HooksHttpHandler(BaseHTTPRequestHa'
44 try:
43 try:
45 result = self._call_hook(method, extras)
44 result = self._call_hook(method, extras)
46 except Exception as e:
45 except Exception as e:
46 exc_tb = traceback.format_exc()
47 result = {
47 result = {
48 'exception': e.__class__.__name__,
48 'exception': e.__class__.__name__,
49 'exception_traceback': exc_tb,
49 'exception_args': e.args
50 'exception_args': e.args
50 }
51 }
51 self._write_response(result)
52 self._write_response(result)
@@ -214,12 +215,14 b' class Hooks(object):'
214 try:
215 try:
215 result = hook(extras)
216 result = hook(extras)
216 except Exception as error:
217 except Exception as error:
218 exc_tb = traceback.format_exc()
217 log.exception('Exception when handling hook %s', hook)
219 log.exception('Exception when handling hook %s', hook)
218 error_args = error.args
220 error_args = error.args
219 return {
221 return {
220 'status': 128,
222 'status': 128,
221 'output': '',
223 'output': '',
222 'exception': type(error).__name__,
224 'exception': type(error).__name__,
225 'exception_traceback': exc_tb,
223 'exception_args': error_args,
226 'exception_args': error_args,
224 }
227 }
225 finally:
228 finally:
General Comments 0
You need to be logged in to leave comments. Login now