Chain exceptions with raise ... from in except blocks
ProprietaryRaise statements inside except blocks should use from to chain the new exception to the caught one, preserving the full traceback. Only a handler that already binds the exception with as is changed, and not where it rebinds that name or the raise sits in a nested function. A bare raise, a raise of the caught exception itself and one that already has from are left alone.
org. openrewrite. python. cleanup. RaiseFromPreviousErrormod run . --recipe= org. openrewrite. python. cleanup. RaiseFromPreviousErrorInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.