Find throw RuntimeException(e) inside a catch block

Proprietary

Wrapping the caught exception in a bare RuntimeException/Exception discards the contextual message the catch site should be adding. Wrap with a domain-specific subclass and a real message (throw FetchFailedException("fetch profile for $userId", e)), or rethrow e directly if there's nothing to add.

org.openrewrite.kotlin.functional.FindWrappingExceptionInCatch$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.functional.FindWrappingExceptionInCatch$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.