# HG changeset patch # User Marcin Kuzminski # Date 2019-01-04 12:30:49 # Node ID f216af0db3b47b5723b069e730bb2a4b7f9c5cd1 # Parent b2eaa2a61f62b79f9b9018cd8a801e20929e764e exception: store orginal tb and exc inside the new exception passed to rhodecode from vcsserver. diff --git a/vcsserver/base.py b/vcsserver/base.py --- a/vcsserver/base.py +++ b/vcsserver/base.py @@ -84,8 +84,11 @@ def raise_from_original(new_type): Raise a new exception type with original args and traceback. """ exc_type, exc_value, exc_traceback = sys.exc_info() + new_exc = new_type(*exc_value.args) + # store the original traceback into the new exc + new_exc._org_exc_tb = traceback.format_exc(exc_traceback) try: - raise new_type(*exc_value.args), None, exc_traceback + raise new_exc, None, exc_traceback finally: del exc_traceback diff --git a/vcsserver/exceptions.py b/vcsserver/exceptions.py --- a/vcsserver/exceptions.py +++ b/vcsserver/exceptions.py @@ -37,6 +37,7 @@ def _make_exception(kind, org_exc, *args exc = Exception(*args) exc._vcs_kind = kind exc._org_exc = org_exc + exc._org_exc_tb = '' return exc diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -362,8 +362,10 @@ class HTTPApplication(object): org_exc = getattr(e, '_org_exc', None) org_exc_name = None + org_exc_tb = '' if org_exc: org_exc_name = org_exc.__class__.__name__ + org_exc_tb = getattr(e, '_org_exc_tb', '') # replace our "faked" exception with our org exc_info[0] = org_exc.__class__ exc_info[1] = org_exc @@ -383,6 +385,7 @@ class HTTPApplication(object): 'message': e.message, 'traceback': tb_info, 'org_exc': org_exc_name, + 'org_exc_tb': org_exc_tb, 'type': type_ } }