When utilizing the executeAsync APIs and the job completes exceptionally, if the continuation.resumeWithException is uncaught by caller, it will be propagated to the job's handler. In TorRuntime implementation's case, that will be the error observer. We want to detach that OnFailure lambda from the execution of the EnqueuedJob and throw the exception outside the lambda.
So, need to implement something comparable to the awaitSync API and replace usage of suspendCancellableCoroutine.
When utilizing the
executeAsync
APIs and the job completes exceptionally, if thecontinuation.resumeWithException
is uncaught by caller, it will be propagated to the job's handler. InTorRuntime
implementation's case, that will be the error observer. We want to detach thatOnFailure
lambda from the execution of theEnqueuedJob
and throw the exception outside the lambda.So, need to implement something comparable to the
awaitSync
API and replace usage ofsuspendCancellableCoroutine
.