##// 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 405 try:
406 406 exc_traceback = exc_data['exc_traceback']
407 407 exc_type_name = exc_data['exc_type_name']
408 exc_value = ''
408 409 except KeyError as err:
409 raise JSONRPCError('Missing exc_traceback, or exc_type_name '
410 'in exc_data_json field. Missing: {}'.format(err))
410 raise JSONRPCError(
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 419 exc_tracking._store_exception(
413 exc_id=exc_id, exc_traceback=exc_traceback,
414 exc_type_name=exc_type_name, prefix=prefix)
420 exc_id=exc_id, exc_info=exc_info, prefix=prefix)
415 421
416 422 exc_url = request.route_url(
417 423 'admin_settings_exception_tracker_show', exception_id=exc_id)
@@ -198,14 +198,19 b' def get_request_metadata(request=None) -'
198 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 202 exc_type, exc_value, exc_traceback = exc_info
203 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)
207 if locals_tb:
208 tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" ""
210 if use_detailed_tb:
211 locals_tb = get_detailed_tb(exc_info)
212 if locals_tb:
213 tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" ""
209 214 return tb
210 215
211 216
General Comments 0
You need to be logged in to leave comments. Login now