title: Why does my Scala future not propagate an Error?
body: <p>This code works as expected:</p>
  
  <pre><code>it("should propagate exceptions") {
    intercept[RuntimeException] {
      val future = Future { Thread.sleep(10); sys.error("whoops"); 22 }
      Await.result(future, Duration.Inf)
    }.getMessage should equal ("whoops")
  }
  </code></pre>
  
  <p>But this doesn't:</p>
  
  <pre><code>it("should propagate errors") {
    intercept[StackOverflowError] {
      val future = Future { Thread.sleep(10); throw new StackOverflowError("dang"); 22 }
      Await.result(future, Duration.Inf)
    }.getMessage should equal ("dang")
  }
  </code></pre>
  
  <p>The future in this second test never returns. Why doesn't an <code>Error</code> subclass (as opposed to an <code>Exception</code> subclass) terminate my future? How should I handle <code>Error</code>s?</p>
  
  <p>EDIT: This is possibly related, but not identical, to <a href="https://stackoverflow.com/questions/38053222/why-does-scala-try-not-catching-java-lang-stackoverflowerror">Why does Scala Try not catching java.lang.StackOverflowError?</a>. I'm not using <code>Try</code> here. The core issue is that the <code>Future</code> never returns at all; I can't catch any error from it because it just hangs.</p>