##// END OF EJS Templates
exc-tracking: fixed API calls with new exceptions store engine
super-admin -
r5147:e3745ca4 default
parent child Browse files
Show More
@@ -405,13 +405,19 b' def store_exception(request, apiuser, ex'
405 try:
405 try:
406 exc_traceback = exc_data['exc_traceback']
406 exc_traceback = exc_data['exc_traceback']
407 exc_type_name = exc_data['exc_type_name']
407 exc_type_name = exc_data['exc_type_name']
408 exc_value = ''
408 except KeyError as err:
409 except KeyError as err:
409 raise JSONRPCError('Missing exc_traceback, or exc_type_name '
410 raise JSONRPCError(
410 'in exc_data_json field. Missing: {}'.format(err))
411 f'Missing exc_traceback, or exc_type_name '
412 f'in exc_data_json field. Missing: {err}')
413
414 class ExcType:
415 __name__ = exc_type_name
416
417 exc_info = (ExcType(), exc_value, exc_traceback)
411
418
412 exc_tracking._store_exception(
419 exc_tracking._store_exception(
413 exc_id=exc_id, exc_traceback=exc_traceback,
420 exc_id=exc_id, exc_info=exc_info, prefix=prefix)
414 exc_type_name=exc_type_name, prefix=prefix)
415
421
416 exc_url = request.route_url(
422 exc_url = request.route_url(
417 'admin_settings_exception_tracker_show', exception_id=exc_id)
423 'admin_settings_exception_tracker_show', exception_id=exc_id)
@@ -198,14 +198,19 b' def get_request_metadata(request=None) -'
198 return request_metadata
198 return request_metadata
199
199
200
200
201 def format_exc(exc_info):
201 def format_exc(exc_info, use_detailed_tb=True):
202 exc_type, exc_value, exc_traceback = exc_info
202 exc_type, exc_value, exc_traceback = exc_info
203 tb = "++ TRACEBACK ++\n\n"
203 tb = "++ TRACEBACK ++\n\n"
204 tb += "".join(traceback.format_exception(exc_type, exc_value, exc_traceback, None))
204 if isinstance(exc_traceback, str):
205 tb += exc_traceback
206 use_detailed_tb = False
207 else:
208 tb += "".join(traceback.format_exception(exc_type, exc_value, exc_traceback, None))
205
209
206 locals_tb = get_detailed_tb(exc_info)
210 if use_detailed_tb:
207 if locals_tb:
211 locals_tb = get_detailed_tb(exc_info)
208 tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" ""
212 if locals_tb:
213 tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" ""
209 return tb
214 return tb
210
215
211
216
General Comments 0
You need to be logged in to leave comments. Login now