I'm reading the docs here <https://kotlin.github.i...
# coroutines
d
I'm reading the docs here https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-deferred/ so
isCompleted
means cancelled or completed, `isCancelled`means cancelled, so to find out if it completed sucessfully there is no easier way than checking for
isCompleted && !isCanclled
?
a
That is not enough if you want to handle failured
d
sure, bad wording on my part - I mean, to find out if it completed without being cancelled
g
I think the hope would be that you could express the successfulness of the operation in the "return value" from the job, either the published messages from the channel or the result from the Deferred. Trying to investigate the state of a coroutine by interrogating its job is likely going to lead to more brittle code than if you encoded the sucess or failure in its output values.