Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
0.11.0.0, 1.0.0
-
None
-
None
Description
The Kafka codebase includes a number of instances where we do `catch t: Throwable` where we should really be doing `catch NonFatal(t)` or `catch NonControl(t)` where `NonFatal` is part of the standard library and `NonControl` is something like:
object NonControl { def apply(t: Throwable): Boolean = t match { case _: ControlThrowable => false case _ => true } def unapply(t: Throwable): Option[Throwable] = if (apply(t)) Some(t) else None }
We can also use `NonControl` to replace cases like (it's more concise and has the same behaviour):
case e: ControlThrowable => throw e case e: Throwable => ...