uli
04/02/2017, 7:42 PMfun main(args: Array<String>) {
val f = future {
throw RuntimeException("Hello!")
}
f.await()
}
Ian
04/02/2017, 7:54 PMfuture {}
will start the coroutine.
But I can see why the exception would be swallowed, I’m just not sure what the solution is to avoid exceptions being silently swallowed thisadeln
04/02/2017, 7:57 PMuli
04/02/2017, 8:31 PMException in thread "main" java.lang.RuntimeException: Hello!
at GlobalKt$main$1$f$1.doResume(global.kt:31)
at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:54)
at kotlinx.coroutines.experimental.DispatchedContinuation$resume$1.run(CoroutineDispatcher.kt:152)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:902)
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1689)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1644)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Ian
04/02/2017, 8:39 PMrunBlocking
instead of future
- since the code just needs to get executed, I don’t care about the result…?uli
04/02/2017, 9:08 PM