Skip to content
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

[Feature]: Add ExceptionGroup support #113

Open
tsv1 opened this issue Jan 3, 2025 · 3 comments
Open

[Feature]: Add ExceptionGroup support #113

tsv1 opened this issue Jan 3, 2025 · 3 comments

Comments

@tsv1
Copy link
Member

tsv1 commented Jan 3, 2025

Summary

Enhance error reporting by adding support for Python's ExceptionGroup (PEP 654). Improve clarity and usability of traceback outputs for grouped exceptions.

Problem

Currently, ExceptionGroup displays only a summary:

Scenarios
*login as userwhen
╭────────────────────────── Traceback (most recent call last) ───────────────────────────╮
│ /scenarios/login_as_user.py:9 in when                                                  │
│                                                                                        │
│    6     subject = "login as user"                                                     │
│    7                                                                                   │
│    8     def when(self):                                                               │
│ ❱  9         raise_exc_group()                                                         │
│   10                                                                                   │
╰────────────────────────────────────────────────────────────────────────────────────────╯
ExceptionGroup: Exception (2 sub-exceptions)

This lacks detailed information about sub-exceptions, making debugging challenging in scenarios with multiple errors.

Proposal

  • Expand ExceptionGroup output to show individual sub-exceptions with full tracebacks.
  • Use clear formatting to separate and label sub-exceptions.

Backward Compatibility Notes

  • Non-ExceptionGroup exceptions remain unaffected.
@tsv1
Copy link
Member Author

tsv1 commented Jan 3, 2025

This feature is blocked by the following issue in the rich library: Support for PEP 654 tracebacks (ExceptionGroups) #1859.

@tsv1
Copy link
Member Author

tsv1 commented Jan 3, 2025

As a workaround, the following commit was added to Vedro: 4452a49. It disables pretty printing of ExceptionGroup in Python 3.11 and later, falling back to the default exception formatting.

@tsv1
Copy link
Member Author

tsv1 commented Jan 4, 2025

💡 Reminder: Ensure exception notes (Exception.add_note(...) from Python 3.11) are displayed in the enhanced ExceptionGroup traceback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant