【发布时间】:2015-07-02 20:32:53
【问题描述】:
在 Scala 中,返回 Future.failed(new Exception("message!")) 和 throw new Exception("message!") 有什么区别?
假设这发生在一个要返回Future[Unit]的函数中,调用函数是这样的:
someFunction onFailure {
case ex: Exception => log("Some exception was thrown")
}
是否有一个优先于另一个的偏好或每个特定的用例?
【问题讨论】:
标签: scala