https://kotlinlang.org logo
#coroutines
Title
# coroutines
l

Lefko

08/12/2021, 8:22 AM
I'm getting crashes from unhandled exceptions from this code (see in thread) but don't understand why since it's surrounded by try/catch. Specifically I'm seeing
java.lang.IllegalArgumentException: userUUID must not be empty
Copy code
override suspend fun loadData(): LoadDataResult<Unit> {
          return try {
              require(userUUID.isNotEmpty()) { "userUUID must not be empty" }
              loadDataAndSaveInDb()
              LoadDataResult.Success(Unit)
          } catch (e: Exception) {
              Timber.e(e, "Error loading data  for user: $userUUID")
              LoadDataResult.Error(e)
          }
      }
2 Views