File tree Expand file tree Collapse file tree
cr-interactors/src/main/java/com/thefuntasty/mvvm/crinteractors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,18 +42,25 @@ interface CoroutineScopeOwner {
4242 onSuccess : (T ) -> Unit ,
4343 onError : ((Throwable ) -> Unit )?
4444 ) {
45- deferred?.cancel()
46- deferred = coroutineScope.async(getWorkerDispatcher()) {
47- build()
48- }.also {
49- coroutineScope.launch(Dispatchers .Main ) {
50- try {
51- onSuccess(it.await())
52- } catch (error: Throwable ) {
53- onError?.invoke(error) ? : throw error
45+ try {
46+ deferred?.cancel()
47+ deferred = coroutineScope.async(getWorkerDispatcher()) {
48+ build()
49+ }.also {
50+ coroutineScope.launch(Dispatchers .Main ) {
51+ try {
52+ onSuccess(it.await())
53+ } catch (error: Exception ) {
54+ onError?.invoke(error) ? : throw error
55+ }
5456 }
5557 }
58+ } catch (cancellation: CancellationException ) {
59+
60+ } catch (error: Exception ) {
61+ onError?.invoke(error) ? : throw error
5662 }
63+
5764 }
5865
5966 /* *
You can’t perform that action at this time.
0 commit comments