Scala

Scala

Made by DeepSource

Classes should not extend java.lang.Error SC-R1045

Anti-pattern
Major

Errors represent situations that are difficult to recover from. Therefore, it is recommended that you do not extend java.lang.Error and instead inherit from java.lang.Exception to denote custom errors/exceptions.

Bad practice

// A very minimal example depicting custom error
class SomeError extends Error

Recommended

// An example of a custom exception
class MyCustomException extends Exception