We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a80b454 + 7ab5cda commit abe7260Copy full SHA for abe7260
_zh-cn/overviews/core/futures.md
@@ -87,7 +87,7 @@ Future的一个重要属性在于它只能被赋值一次。一旦给定了某
87
88
f onComplete {
89
case Success(posts) => for (post <- posts) println(post)
90
- case Success(posts) => for (post <- posts) println(post)
+ case Failure(t) => println("An error has occured: " + t.getMessage)
91
}
92
93
onComplete方法一般在某种意义上它允许客户处理future计算出的成功或失败的结果。对于仅仅处理成功的结果,onSuccess 回调使用如下(该回调以一个偏函数(partial function)为参数):
0 commit comments