Permalink
Browse files

SI-7164 - Removing NotImplementedError as Fatal from s.u.c.NonFatal

  • Loading branch information...
1 parent 70956e5 commit 68f62d7e9c200034bd42ffaf795b57fb379d9d38 @viktorklang viktorklang committed Feb 21, 2013
@@ -11,7 +11,7 @@ package scala.util.control
/**
* Extractor of non-fatal Throwables. Will not match fatal errors like `VirtualMachineError`
* (for example, `OutOfMemoryError`, a subclass of `VirtualMachineError`), `ThreadDeath`,
- * `LinkageError`, `InterruptedException`, `ControlThrowable`, or `NotImplementedError`.
+ * `LinkageError`, `InterruptedException`, `ControlThrowable`.
* However, `StackOverflowError` is matched, i.e. considered non-fatal.
*
* Note that [[scala.util.control.ControlThrowable]], an internal Throwable, is not matched by
@@ -35,7 +35,7 @@ object NonFatal {
def apply(t: Throwable): Boolean = t match {
case _: StackOverflowError => true // StackOverflowError ok even though it is a VirtualMachineError
// VirtualMachineError includes OutOfMemoryError and other fatal errors
- case _: VirtualMachineError | _: ThreadDeath | _: InterruptedException | _: LinkageError | _: ControlThrowable | _: NotImplementedError => false
+ case _: VirtualMachineError | _: ThreadDeath | _: InterruptedException | _: LinkageError | _: ControlThrowable => false
case _ => true
}
/**
@@ -77,7 +77,7 @@ object FutureTests extends MinimalScalaTest {
val logThrowable: Throwable => Unit = p.trySuccess(_)
val ec: ExecutionContext = ExecutionContext.fromExecutor(null, logThrowable)
- val t = new NotImplementedError("foo")
+ val t = new InterruptedException()
val f = Future(throw t)(ec)
Await.result(p.future, 2.seconds) mustBe t
}
@@ -7,16 +7,16 @@ trait NonFatalTests {
Seq(new StackOverflowError,
new RuntimeException,
new Exception,
- new Throwable)
+ new Throwable,
+ new NotImplementedError)
//Fatals
val fatals: Seq[Throwable] =
Seq(new InterruptedException,
new OutOfMemoryError,
new LinkageError,
new VirtualMachineError {},
- new Throwable with scala.util.control.ControlThrowable,
- new NotImplementedError)
+ new Throwable with scala.util.control.ControlThrowable)
def testFatalsUsingApply(): Unit = {
fatals foreach { t => assert(NonFatal(t) == false) }

0 comments on commit 68f62d7

Please sign in to comment.