【发布时间】:2017-01-11 01:59:46
【问题描述】:
我的问题
异常后是否可以继续执行协程?
示例
try {
someMethod1()
someMethod2() //Throws an exception!
someMethod3()
} catch(e: Exception) {
//I do not want to call someMethod3 here!
//I want the coroutine to resume after the exception inside of the original block.
} finally {
//I also do not want to call someMethod3 here!
//I want the coroutine to resume after the exception inside of the original block.
}
我不确定这是否可能,但提前感谢您查看!
【问题讨论】:
-
我认为它类似于 Java,即不可能。这不是 Lisp ;)
-
这就是它的样子。该死。谢谢!
-
我认为这是不可能的。我想这也不应该是可能的。我会争辩说,如果您可以在异常后恢复执行,那么该异常毕竟不是“异常”。
标签: exception kotlin coroutine