-
Notifications
You must be signed in to change notification settings - Fork 705
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for formatting of "ExceptionGroup" errors
- Loading branch information
Showing
15 changed files
with
1,301 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
186 changes: 186 additions & 0 deletions
186
tests/exceptions/output/modern/grouped_as_cause_and_context.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
|
||
+ Exception Group Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 31, in main | ||
| raise ExceptionGroup("group_1", [error_1, error_2]) | ||
| ExceptionGroup: group_1 (2 sub-exceptions) | ||
+-+---------------- 1 ---------------- | ||
| Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 20, in main | ||
| a() | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 10, in a | ||
| 1 / 0 | ||
| ZeroDivisionError: division by zero | ||
+---------------- 2 ---------------- | ||
| Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 25, in main | ||
| b() | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 14, in b | ||
| raise ValueError("Error") | ||
| ValueError: Error | ||
+------------------------------------ | ||
|
||
The above exception was the direct cause of the following exception: | ||
|
||
+ Exception Group Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 33, in main | ||
| raise ExceptionGroup("group_2", [error_2, error_1]) from err | ||
| ExceptionGroup: group_2 (2 sub-exceptions) | ||
+-+---------------- 1 ---------------- | ||
| Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 25, in main | ||
| b() | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 14, in b | ||
| raise ValueError("Error") | ||
| ValueError: Error | ||
+---------------- 2 ---------------- | ||
| Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 20, in main | ||
| a() | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 10, in a | ||
| 1 / 0 | ||
| ZeroDivisionError: division by zero | ||
+------------------------------------ | ||
|
||
During handling of the above exception, another exception occurred: | ||
|
||
+ Exception Group Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 42, in <module> | ||
| main() | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 35, in main | ||
| raise ExceptionGroup("group_3", [err]) | ||
| ExceptionGroup: group_3 (1 sub-exception) | ||
+-+---------------- 1 ---------------- | ||
| Exception Group Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 33, in main | ||
| raise ExceptionGroup("group_2", [error_2, error_1]) from err | ||
| ExceptionGroup: group_2 (2 sub-exceptions) | ||
+-+---------------- 1 ---------------- | ||
| Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 25, in main | ||
| b() | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 14, in b | ||
| raise ValueError("Error") | ||
| ValueError: Error | ||
+---------------- 2 ---------------- | ||
| Traceback (most recent call last): | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 20, in main | ||
| a() | ||
| File "tests/exceptions/source/modern/grouped_as_cause_and_context.py", line 10, in a | ||
| 1 / 0 | ||
| ZeroDivisionError: division by zero | ||
+------------------------------------ | ||
|
||
+ [33m[1mException Group Traceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m31[0m, in [35mmain[0m | ||
| [35m[1mraise[0m [1mExceptionGroup[0m[1m([0m[36m"group_1"[0m[1m,[0m [1m[[0m[1merror_1[0m[1m,[0m [1merror_2[0m[1m][0m[1m)[0m | ||
| [36m │ └ [0m[36m[1mValueError('Error')[0m | ||
| [36m └ [0m[36m[1mZeroDivisionError('division by zero')[0m | ||
| | ||
| [31m[1mExceptionGroup[0m:[1m group_1 (2 sub-exceptions)[0m | ||
+-+---------------- 1 ---------------- | ||
| [33m[1mTraceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m20[0m, in [35mmain[0m | ||
| [1ma[0m[1m([0m[1m)[0m | ||
| [36m└ [0m[36m[1m<function a at 0xDEADBEEF>[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m10[0m, in [35ma[0m | ||
| [34m[1m1[0m [35m[1m/[0m [34m[1m0[0m | ||
| | ||
| [31m[1mZeroDivisionError[0m:[1m division by zero[0m | ||
+---------------- 2 ---------------- | ||
| [33m[1mTraceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m25[0m, in [35mmain[0m | ||
| [1mb[0m[1m([0m[1m)[0m | ||
| [36m└ [0m[36m[1m<function b at 0xDEADBEEF>[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m14[0m, in [35mb[0m | ||
| [35m[1mraise[0m [1mValueError[0m[1m([0m[36m"Error"[0m[1m)[0m | ||
| | ||
| [31m[1mValueError[0m:[1m Error[0m | ||
+------------------------------------ | ||
|
||
|
||
[1mThe above exception was the direct cause of the following exception:[0m | ||
|
||
|
||
+ [33m[1mException Group Traceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m33[0m, in [35mmain[0m | ||
| [35m[1mraise[0m [1mExceptionGroup[0m[1m([0m[36m"group_2"[0m[1m,[0m [1m[[0m[1merror_2[0m[1m,[0m [1merror_1[0m[1m][0m[1m)[0m [35m[1mfrom[0m [1merr[0m | ||
| [36m │ └ [0m[36m[1mZeroDivisionError('division by zero')[0m | ||
| [36m └ [0m[36m[1mValueError('Error')[0m | ||
| | ||
| [31m[1mExceptionGroup[0m:[1m group_2 (2 sub-exceptions)[0m | ||
+-+---------------- 1 ---------------- | ||
| [33m[1mTraceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m25[0m, in [35mmain[0m | ||
| [1mb[0m[1m([0m[1m)[0m | ||
| [36m└ [0m[36m[1m<function b at 0xDEADBEEF>[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m14[0m, in [35mb[0m | ||
| [35m[1mraise[0m [1mValueError[0m[1m([0m[36m"Error"[0m[1m)[0m | ||
| | ||
| [31m[1mValueError[0m:[1m Error[0m | ||
+---------------- 2 ---------------- | ||
| [33m[1mTraceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m20[0m, in [35mmain[0m | ||
| [1ma[0m[1m([0m[1m)[0m | ||
| [36m└ [0m[36m[1m<function a at 0xDEADBEEF>[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m10[0m, in [35ma[0m | ||
| [34m[1m1[0m [35m[1m/[0m [34m[1m0[0m | ||
| | ||
| [31m[1mZeroDivisionError[0m:[1m division by zero[0m | ||
+------------------------------------ | ||
|
||
|
||
[1mDuring handling of the above exception, another exception occurred:[0m | ||
|
||
|
||
+ [33m[1mException Group Traceback (most recent call last):[0m | ||
| | ||
| > File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m42[0m, in [35m<module>[0m | ||
| [1mmain[0m[1m([0m[1m)[0m | ||
| [36m└ [0m[36m[1m<function main at 0xDEADBEEF>[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m35[0m, in [35mmain[0m | ||
| [35m[1mraise[0m [1mExceptionGroup[0m[1m([0m[36m"group_3"[0m[1m,[0m [1m[[0m[1merr[0m[1m][0m[1m)[0m | ||
| | ||
| [31m[1mExceptionGroup[0m:[1m group_3 (1 sub-exception)[0m | ||
+-+---------------- 1 ---------------- | ||
| [33m[1mException Group Traceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m33[0m, in [35mmain[0m | ||
| [35m[1mraise[0m [1mExceptionGroup[0m[1m([0m[36m"group_2"[0m[1m,[0m [1m[[0m[1merror_2[0m[1m,[0m [1merror_1[0m[1m][0m[1m)[0m [35m[1mfrom[0m [1merr[0m | ||
| [36m │ └ [0m[36m[1mZeroDivisionError('division by zero')[0m | ||
| [36m └ [0m[36m[1mValueError('Error')[0m | ||
| | ||
| [31m[1mExceptionGroup[0m:[1m group_2 (2 sub-exceptions)[0m | ||
+-+---------------- 1 ---------------- | ||
| [33m[1mTraceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m25[0m, in [35mmain[0m | ||
| [1mb[0m[1m([0m[1m)[0m | ||
| [36m└ [0m[36m[1m<function b at 0xDEADBEEF>[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m14[0m, in [35mb[0m | ||
| [35m[1mraise[0m [1mValueError[0m[1m([0m[36m"Error"[0m[1m)[0m | ||
| | ||
| [31m[1mValueError[0m:[1m Error[0m | ||
+---------------- 2 ---------------- | ||
| [33m[1mTraceback (most recent call last):[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m20[0m, in [35mmain[0m | ||
| [1ma[0m[1m([0m[1m)[0m | ||
| [36m└ [0m[36m[1m<function a at 0xDEADBEEF>[0m | ||
| | ||
| File "[32mtests/exceptions/source/modern/[0m[32m[1mgrouped_as_cause_and_context.py[0m", line [33m10[0m, in [35ma[0m | ||
| [34m[1m1[0m [35m[1m/[0m [34m[1m0[0m | ||
| | ||
| [31m[1mZeroDivisionError[0m:[1m division by zero[0m | ||
+------------------------------------ |
Oops, something went wrong.