https://kotlinlang.org logo
i

Ian

04/03/2017, 8:41 PM
I’m going to re-ask my question, because I think it wasn’t very clear before: Some functions in the library I’m building return `CompletableFuture`s. I have been recommending that my users take advantage of Kotlin’s coroutines to handle these in a synchronous manner, eg.
Copy code
doStuff()
  doMoreStuff()
  future {
     val completableFuture = createCompletableFuture()
     val a = completableFuture.await() + 5
     ...
  }
My users don’t really care about whatever is returned by
future
, so long as the code inside the
future
block gets executed. The problem is that if any method inside the
future
block throws an exception, it appears to be swallowed silently. My sense is that I shouldn’t be suggesting they use
future
, but I’m not sure how I can recommend they do this in a way that won’t silently swallow exceptions. Advice appreciated?