When is ExecutionContext # reportFailure (Throwable) called?

This is a pretty general question, but hopefully reasonable. When is it called ExecutionContext#reportFailure(Throwable)?

It does not seem to be called in the Scala standard library. I suppose I should perhaps call it in some cases? What is it?

+4
source share
2 answers

This method reports exceptions that are not reported otherwise.

, , . , Future.onComplete (, Future.foreach) Unit , . onComplete, .

+3

Promise . .

try onComplete(value) catch { case NonFatal(e) => executor reportFailure e }

An ExecutionContext reportFailure , / . , , - ExecutionContextImpl, API, . reporter: Throwable => Unit. ExecutionContext.Implicits.global ExecutionContext.defaultReporter, System.err.

, ExecutionContext. , - , - .

+2

All Articles