Scala

Scala

Made by DeepSource

Exception is generalized in the catch clause SC-R1055

Anti-pattern
Major

All exceptions such as IllegalArgumentException are sub types of RuntimeException. Trapping a specific exception and then throwing a generalized Exception is considered a bad practice and should be avoided. If the existing exceptions are not relevant to your use case, consider defining your own.

Bad Practice

case inv: IllegalArgumentException => throw new Exception()

Recommended

case inv: IllegalArgumentException => throw new UseCaseSpecificException()