##// END OF EJS Templates
exc-tracking: synced with CE code
super-admin -
r1166:020860b6 default
parent child Browse files
Show More
@@ -141,31 +141,32 b' def get_request_metadata(request=None) -'
141 return request_metadata
141 return request_metadata
142
142
143
143
144 def format_exc(exc_info):
144 def format_exc(exc_info, use_detailed_tb=True):
145 exc_type, exc_value, exc_traceback = exc_info
145 exc_type, exc_value, exc_traceback = exc_info
146 tb = "++ TRACEBACK ++\n\n"
146 tb = "++ TRACEBACK ++\n\n"
147 tb += "".join(traceback.format_exception(exc_type, exc_value, exc_traceback, None))
147 tb += "".join(traceback.format_exception(exc_type, exc_value, exc_traceback, None))
148
148
149 detailed_tb = getattr(exc_value, "_org_exc_tb", None)
149 detailed_tb = getattr(exc_value, "_org_exc_tb", None)
150
150
151 if detailed_tb:
151 if detailed_tb:
152 remote_tb = detailed_tb
152 remote_tb = detailed_tb
153 if isinstance(detailed_tb, str):
153 if isinstance(detailed_tb, str):
154 remote_tb = [detailed_tb]
154 remote_tb = [detailed_tb]
155
155
156 tb += (
156 tb += (
157 "\n+++ BEG SOURCE EXCEPTION +++\n\n"
157 "\n+++ BEG SOURCE EXCEPTION +++\n\n"
158 "{}\n"
158 "{}\n"
159 "+++ END SOURCE EXCEPTION +++\n"
159 "+++ END SOURCE EXCEPTION +++\n"
160 "".format("\n".join(remote_tb))
160 "".format("\n".join(remote_tb))
161 )
161 )
162
162
163 # Avoid that remote_tb also appears in the frame
163 # Avoid that remote_tb also appears in the frame
164 del remote_tb
164 del remote_tb
165
165
166 locals_tb = get_detailed_tb(exc_info)
166 if use_detailed_tb:
167 if locals_tb:
167 locals_tb = get_detailed_tb(exc_info)
168 tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" ""
168 if locals_tb:
169 tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" ""
169 return tb
170 return tb
170
171
171
172
General Comments 0
You need to be logged in to leave comments. Login now