Home > Enterprise >  Difference between .resumeWith(Result.failure(...)) and .resumeWithException
Difference between .resumeWith(Result.failure(...)) and .resumeWithException

Time:01-22

I might be missing some fundamental understanding of coroutines and continuations in Kotlin, but I couldn't find any information on the difference between

Continuation<T>.resumeWith(Result.failure(/* some exception */))
// and
Continuation<T>.resumeWithException(/* some exception */)

and the same for

Continuation<T>.resumeWith(Result.success(/* some value */))
// and
Continuation<T>.resume(/* some value */)

When should which one be used and why?

CodePudding user response:

It all comes down to usage of enter image description here

And yeah you are right it's exactly the same. The only difference is the amount of code you have to write

  •  Tags:  
  • Related