Show More
@@ -84,8 +84,11 b' def raise_from_original(new_type):' | |||||
84 | Raise a new exception type with original args and traceback. |
|
84 | Raise a new exception type with original args and traceback. | |
85 | """ |
|
85 | """ | |
86 | exc_type, exc_value, exc_traceback = sys.exc_info() |
|
86 | exc_type, exc_value, exc_traceback = sys.exc_info() | |
|
87 | new_exc = new_type(*exc_value.args) | |||
|
88 | # store the original traceback into the new exc | |||
|
89 | new_exc._org_exc_tb = traceback.format_exc(exc_traceback) | |||
87 |
|
90 | |||
88 | try: |
|
91 | try: | |
89 |
raise new_ |
|
92 | raise new_exc, None, exc_traceback | |
90 | finally: |
|
93 | finally: | |
91 | del exc_traceback |
|
94 | del exc_traceback |
@@ -37,6 +37,7 b' def _make_exception(kind, org_exc, *args' | |||||
37 | exc = Exception(*args) |
|
37 | exc = Exception(*args) | |
38 | exc._vcs_kind = kind |
|
38 | exc._vcs_kind = kind | |
39 | exc._org_exc = org_exc |
|
39 | exc._org_exc = org_exc | |
|
40 | exc._org_exc_tb = '' | |||
40 | return exc |
|
41 | return exc | |
41 |
|
42 | |||
42 |
|
43 |
@@ -362,8 +362,10 b' class HTTPApplication(object):' | |||||
362 |
|
362 | |||
363 | org_exc = getattr(e, '_org_exc', None) |
|
363 | org_exc = getattr(e, '_org_exc', None) | |
364 | org_exc_name = None |
|
364 | org_exc_name = None | |
|
365 | org_exc_tb = '' | |||
365 | if org_exc: |
|
366 | if org_exc: | |
366 | org_exc_name = org_exc.__class__.__name__ |
|
367 | org_exc_name = org_exc.__class__.__name__ | |
|
368 | org_exc_tb = getattr(e, '_org_exc_tb', '') | |||
367 | # replace our "faked" exception with our org |
|
369 | # replace our "faked" exception with our org | |
368 | exc_info[0] = org_exc.__class__ |
|
370 | exc_info[0] = org_exc.__class__ | |
369 | exc_info[1] = org_exc |
|
371 | exc_info[1] = org_exc | |
@@ -383,6 +385,7 b' class HTTPApplication(object):' | |||||
383 | 'message': e.message, |
|
385 | 'message': e.message, | |
384 | 'traceback': tb_info, |
|
386 | 'traceback': tb_info, | |
385 | 'org_exc': org_exc_name, |
|
387 | 'org_exc': org_exc_name, | |
|
388 | 'org_exc_tb': org_exc_tb, | |||
386 | 'type': type_ |
|
389 | 'type': type_ | |
387 | } |
|
390 | } | |
388 | } |
|
391 | } |
General Comments 0
You need to be logged in to leave comments.
Login now