Scala

Scala

Made by DeepSource

Exception is instantiated using new but is not thrown SC-W1085

Bug risk
Major

An exception was instantiated using the new keyword. However, it was not thrown using the throw keyword and is neither assigned to a variable nor passed as an argument. This makes the instantiation redundant. Either throw the exception or remove the statement entirely.

Bad Practice

new IllegalArgumentException()

Recommended

throw new IllegalArgumentException();