-
Notifications
You must be signed in to change notification settings - Fork 569
Better handling of exception groups #4117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
cc8e329
1c2c5c1
e5d4f56
8c957c6
8062aa3
5c45019
d1b06c6
f3791ec
781925a
5a3a3ac
e36d43e
72f3f84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -697,7 +697,8 @@ def single_exception_from_error_tuple( | |
| is_root_exception = exception_id == 0 | ||
| if not is_root_exception and parent_id is not None: | ||
| exception_value["mechanism"]["parent_id"] = parent_id | ||
| exception_value["mechanism"]["type"] = "chained" | ||
| if exception_id is not None and exception_id > 0: | ||
| exception_value["mechanism"]["type"] = "chained" | ||
|
|
||
| if is_root_exception and "type" not in exception_value["mechanism"]: | ||
| exception_value["mechanism"]["type"] = "generic" | ||
|
|
@@ -897,36 +898,17 @@ def exceptions_from_error_tuple( | |
| # type: (...) -> List[Dict[str, Any]] | ||
| exc_type, exc_value, tb = exc_info | ||
|
|
||
| is_exception_group = BaseExceptionGroup is not None and isinstance( | ||
| exc_value, BaseExceptionGroup | ||
| _, exceptions = exceptions_from_error( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [question] does the From naively looking at the diff, it seems that the code for handling exceptions which are not exception groups has been deleted, so I am just wondering where this logic is handled now.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have now updated the code to make it easier to grasp what is happening. (The diff is very hard to read, just checkout the file) The function (We can in another PR also think about removing |
||
| exc_type=exc_type, | ||
| exc_value=exc_value, | ||
| tb=tb, | ||
| client_options=client_options, | ||
| mechanism=mechanism, | ||
| exception_id=0, | ||
| parent_id=0, | ||
| full_stack=full_stack, | ||
| ) | ||
|
|
||
| if is_exception_group: | ||
| (_, exceptions) = exceptions_from_error( | ||
| exc_type=exc_type, | ||
| exc_value=exc_value, | ||
| tb=tb, | ||
| client_options=client_options, | ||
| mechanism=mechanism, | ||
| exception_id=0, | ||
| parent_id=0, | ||
| full_stack=full_stack, | ||
| ) | ||
|
|
||
| else: | ||
| exceptions = [] | ||
| for exc_type, exc_value, tb in walk_exception_chain(exc_info): | ||
| exceptions.append( | ||
| single_exception_from_error_tuple( | ||
| exc_type=exc_type, | ||
| exc_value=exc_value, | ||
| tb=tb, | ||
| client_options=client_options, | ||
| mechanism=mechanism, | ||
| full_stack=full_stack, | ||
| ) | ||
| ) | ||
|
|
||
| exceptions.reverse() | ||
|
|
||
| return exceptions | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.