completeExceptionally

abstract fun completeExceptionally(exception: Throwable): Boolean(source)

Completes this deferred value exceptionally with a given exception. The result is true if this deferred was completed as a result of this invocation and false otherwise (if it was already completed).

Subsequent invocations of this function have no effect and always produce false.

This function transitions this deferred into cancelled state if it was not completed or cancelled yet. However, that if this deferred has children, then it transitions into cancelling state and becomes cancelled once all its children are complete. See Job for details.