[Codelab Issue] Testing Codelab 5.2#, Step #4 - getTasks() function throws error
alifatma13 opened this issue · comments
Describe the problem
When I copy the code for getTasks() it gives an error because one of the return statements returns "Error" rather than Result.Error
In which lesson and step of the codelab can this issue be found?
5.2, Step 4
How to reproduce?
Copy and paste the code in FakeDataSource.kt created. The code won't compile
Versions
- What version of Android Studio are you using?
Version 4.1.2
Additional information
Change the getTasks code to the following:
override suspend fun getTasks(): Result<List<Task>> {
tasks?.let { return Result.Success(ArrayList(it)) }
return Result.Error(
Exception("Tasks not found")
)
}
codelab: advanced-android-kotlin
You need to import the correct Result.Error