Scala

Scala

Made by DeepSource

Missing catch clause for try SC-W1081

Bug risk
Critical

The catch clause allows you to recover from exceptions that were thrown in the try block whereas the finally clause allows you to close or free any resources that were acquired as a part of the exception handling and recovery. Having no associated catch clause is same as not having any try-catch at all. It is therefore recommended that you either add an associated catch clause or omit the exception handling and recovery entirely and let your code throw exceptions.

Bad Practice

try {
  // ...
} finally {
  // ...
}

Recommended

try {
  // ...
} catch {
  // ...
} finally {
  // ...
}