try:
...
except Exception as e:
if ...:
raise RuntimeError("boom!")
else:
raise RuntimeError("bang!")
ruff only identifies B904 on line 5, and not on line 7:
:5:9: B904 Within an except clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
ruff 0.0.246