Type mismatch: inferred type is Resource<Exception> but Resource<T> was expected
For my firebase job I created base firebase repository to handle onSuccess and on error.
I can use it for all my firebase job but when I try to handle error I got this error.
why can I post documentReference but can't post exception.
Here is my code:
suspend inline fun firebaseJob(crossinline task: () -> Task): Resource {
return withContext(
Dispatchers.IO) {
try {
suspendCancellableCoroutine { continuation ->
task().addOnSuccessListener {...