Skip to content

verbose-raise

Pythonstyleno fixdefault: offpython/ruff

Reports raise e in an except ... as e clause.

raise e adds the current line to the traceback of the exception, so the output shows two places for one error. A bare raise re-raises it with the traceback as it was.

To fix, write raise.

Reported
...
try:
pass
except ValueError as e:
raise e
...
python:
lint:
rules:
verbose-raise: warn # off (default), warn, error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line verbose-raise in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff TRY201 full