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

Improve exception traceback readability #6836

Merged
merged 3 commits into from Dec 30, 2022

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Dec 28, 2022

New users often struggle with tracebacks, especially when they're long.

This is a small change to help simplify the output and avoid repetition in tracebacks.

Before

Here's a simple example from https://github.com/henryiii/flake8-errmsg:

sub = "Some value"
raise RuntimeError(f"{sub!r} is incorrect")
Traceback (most recent call last):
  File "tmp.py", line 2, in <module>
    raise RuntimeError(f"{sub!r} is incorrect")
RuntimeError: 'Some value' is incorrect

After

sub = "Some value"
msg = f"{sub!r} is incorrect"
raise RuntimeError(msg)
Traceback (most recent call last):
  File "tmp.py", line 3, in <module>
    raise RuntimeError(msg)
RuntimeError: 'Some value' is incorrect

@radarhere radarhere merged commit c7f633c into python-pillow:main Dec 30, 2022
@hugovk hugovk deleted the flake8-errmsg branch December 30, 2022 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants