diff --git a/vcsserver/lib/exc_tracking.py b/vcsserver/lib/exc_tracking.py --- a/vcsserver/lib/exc_tracking.py +++ b/vcsserver/lib/exc_tracking.py @@ -141,31 +141,32 @@ def get_request_metadata(request=None) - return request_metadata -def format_exc(exc_info): +def format_exc(exc_info, use_detailed_tb=True): exc_type, exc_value, exc_traceback = exc_info tb = "++ TRACEBACK ++\n\n" tb += "".join(traceback.format_exception(exc_type, exc_value, exc_traceback, None)) - + detailed_tb = getattr(exc_value, "_org_exc_tb", None) - + if detailed_tb: remote_tb = detailed_tb if isinstance(detailed_tb, str): remote_tb = [detailed_tb] - + tb += ( "\n+++ BEG SOURCE EXCEPTION +++\n\n" "{}\n" "+++ END SOURCE EXCEPTION +++\n" "".format("\n".join(remote_tb)) ) - + # Avoid that remote_tb also appears in the frame del remote_tb - - locals_tb = get_detailed_tb(exc_info) - if locals_tb: - tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" "" + + if use_detailed_tb: + locals_tb = get_detailed_tb(exc_info) + if locals_tb: + tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" "" return tb