Show More
@@ -863,13 +863,10 b' class VerboseTB(TBTools):' | |||||
863 | direct_cause = "\nThe above exception was the direct cause of the following exception:\n" |
|
863 | direct_cause = "\nThe above exception was the direct cause of the following exception:\n" | |
864 | exception_during_handling = "\nDuring handling of the above exception, another exception occurred:\n" |
|
864 | exception_during_handling = "\nDuring handling of the above exception, another exception occurred:\n" | |
865 |
|
865 | |||
866 | colors = self.Colors # just a shorthand + quicker name lookup |
|
|||
867 | colorsnormal = colors.Normal # used a lot |
|
|||
868 | head = '%s%s%s' % (colors.topline, '-' * 75, colorsnormal) |
|
|||
869 | if cause: |
|
866 | if cause: | |
870 |
message = [[ |
|
867 | message = [[direct_cause]] | |
871 | else: |
|
868 | else: | |
872 |
message = [[ |
|
869 | message = [[exception_during_handling]] | |
873 | return message |
|
870 | return message | |
874 |
|
871 | |||
875 | def prepare_header(self, etype, long_version=False): |
|
872 | def prepare_header(self, etype, long_version=False): | |
@@ -888,9 +885,8 b' class VerboseTB(TBTools):' | |||||
888 | "\ncalls leading up to the error, with the most recent (innermost) call last." |
|
885 | "\ncalls leading up to the error, with the most recent (innermost) call last." | |
889 | else: |
|
886 | else: | |
890 | # Simplified header |
|
887 | # Simplified header | |
891 | head = '%s%s%s\n%s%s' % (colors.topline, '-' * 75, colorsnormal, exc, |
|
888 | head = '%s%s' % (exc, 'Traceback (most recent call last)'. \ | |
892 | 'Traceback (most recent call last)'. \ |
|
889 | rjust(75 - len(str(etype))) ) | |
893 | rjust(75 - len(str(etype))) ) |
|
|||
894 |
|
890 | |||
895 | return head |
|
891 | return head | |
896 |
|
892 | |||
@@ -990,11 +986,14 b' class VerboseTB(TBTools):' | |||||
990 | formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context, |
|
986 | formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context, | |
991 | tb_offset) |
|
987 | tb_offset) | |
992 |
|
988 | |||
|
989 | colors = self.Colors # just a shorthand + quicker name lookup | |||
|
990 | colorsnormal = colors.Normal # used a lot | |||
|
991 | head = '%s%s%s' % (colors.topline, '-' * 75, colorsnormal) | |||
|
992 | structured_traceback_parts = [head] | |||
993 | if py3compat.PY3: |
|
993 | if py3compat.PY3: | |
994 | chained_exceptions_tb_offset = 0 |
|
994 | chained_exceptions_tb_offset = 0 | |
995 | lines_of_context = 3 |
|
995 | lines_of_context = 3 | |
996 | formatted_exceptions = formatted_exception |
|
996 | formatted_exceptions = formatted_exception | |
997 | structured_traceback_parts = [] |
|
|||
998 | exception = self.get_exception_from_context(evalue) |
|
997 | exception = self.get_exception_from_context(evalue) | |
999 | if exception: |
|
998 | if exception: | |
1000 | formatted_exceptions += self.prepare_chained_exception_message(evalue.__cause__) |
|
999 | formatted_exceptions += self.prepare_chained_exception_message(evalue.__cause__) | |
@@ -1016,7 +1015,7 b' class VerboseTB(TBTools):' | |||||
1016 | for formatted_exception in reversed(formatted_exceptions): |
|
1015 | for formatted_exception in reversed(formatted_exceptions): | |
1017 | structured_traceback_parts += formatted_exception |
|
1016 | structured_traceback_parts += formatted_exception | |
1018 | else: |
|
1017 | else: | |
1019 | structured_traceback_parts = formatted_exception[0] |
|
1018 | structured_traceback_parts += formatted_exception[0] | |
1020 |
|
1019 | |||
1021 | return structured_traceback_parts |
|
1020 | return structured_traceback_parts | |
1022 |
|
1021 |
General Comments 0
You need to be logged in to leave comments.
Login now