getCancellationException
abstract fun getCancellationException(): CancellationException
(source)Returns CancellationException that signals the completion of this job. This function is used by cancellable suspending functions. They throw exception returned by this function when they suspend in the context of this job and this job becomes complete.
This function returns the original cancel cause of this job if that cause
was an instance of
CancellationException. Otherwise (if this job was cancelled with a cause of a different type, or
was cancelled without a cause, or had completed normally), an instance of JobCancellationException is
returned. The JobCancellationException.cause of the resulting JobCancellationException references
the original cancellation cause that was passed to cancel function.
This function throws IllegalStateException when invoked on a job that has not completed nor cancelled yet.