Extractor of non-fatal Throwables. Will not match fatal errors likeVirtualMachineError (for example,OutOfMemoryError andStackOverflowError, subclasses ofVirtualMachineError),ThreadDeath,LinkageError,InterruptedException,ControlThrowable.
Note thatscala.util.control.ControlThrowable, an internal Throwable, is not matched byNonFatal (and would therefore be thrown).
For example, all harmless Throwables can be caught by:
try { // dangerous stuff} catch { case NonFatal(e) => log.error(e, "Something not that bad.") // or case e if NonFatal(e) => log.error(e, "Something not that bad.")}Returns true if the providedThrowable is to be considered non-fatal, or false if it is to be considered fatal
Returns true if the providedThrowable is to be considered non-fatal, or false if it is to be considered fatal
Returns Some(t) if NonFatal(t) == true, otherwise None