object Throwables
Helper class for determining whether a Throwable is fatal or not.
User should only catch the non-fatal one,and keep rethrow the fatal one.
Fatal errors are errors like VirtualMachineError
(for example, OutOfMemoryError and StackOverflowError, subclasses of VirtualMachineError), ThreadDeath,
LinkageError, InterruptedException, ControlThrowable.
Note. this helper keep the same semantic with NonFatal in Scala.
For example, all harmless Throwables can be caught by:
try { // dangerous stuff } catch(Throwable e) { if (Throwables.isNonFatal(e)){ log.error(e, "Something not that bad."); } else { throw e; }
- Source
- Throwables.scala
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- Throwables
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Value Members
-
def
isFatal(throwable: Throwable): Boolean
Returns true if the provided
Throwableis to be considered fatal, or false if it is to be considered non-fatal -
def
isNonFatal(throwable: Throwable): Boolean
Returns true if the provided
Throwableis to be considered non-fatal, or false if it is to be considered fatal