bj0
08/23/2018, 5:59 PMJobCancellationException
instead of CancellationException
?elizarov
08/23/2018, 6:03 PMCompletableFuture
-based async code. We only throw JobCancellationException
, but support any CancellationException
for interop with Java.bj0
08/23/2018, 6:04 PMelizarov
08/23/2018, 6:04 PMbj0
08/23/2018, 6:05 PM} catch (e: JobCancellationException) {
statusChannel.offer(ConnectionStatus.Disconnected)
throw e
}
elizarov
08/23/2018, 6:07 PMbj0
08/23/2018, 6:07 PMcatch (t: Throwable) {
statusChannel.offer(ConnectionStatus.Error("exception thrown: ${t.message}"))
throw t
}
run
function that connects and then suspends while the connection is active. It can then be disconnected by canceling from the caller.elizarov
08/23/2018, 6:10 PMcatch (t: Throwable) { statusChannel.offer(t.toStatusMessage())
throw t
}
bj0
08/23/2018, 6:10 PMwhen(t)
in an extension method instead of multiple catch
blocks? if it's only used in one location whats that buy you? readability?elizarov
08/24/2018, 6:43 AM