getCompletionExceptionOrNull

abstract fun getCompletionExceptionOrNull(): Throwable? (source)

Returns completion exception result if this deferred completed exceptionally, null if it is completed normally, or throws IllegalStateException if this deferred value has not completed yet.

This function is designed to be used from invokeOnCompletion handlers, when there is an absolute certainty that the value is already complete. See also getCompleted.