Skip to content

Conversation

@ArtemRem
Copy link

No description provided.



sealed class Result {
data class Success(val catData: Cat) : Result()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success по условиям задачи должен быть дженериком

private val exceptionHandler = CoroutineExceptionHandler { _, e ->
CrashMonitor.trackWarning("${e.message}")
_uiState.value = Result.Error(
Throwable()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут потеряется исходная ошибка, можно использовать e

// try {
// val fact = async { catsService.getCatFact() }.await()
// val catImages:List<CatImage> = async { catsImagesService.getCatImage() }.await()
// _catsView?.populate(fact, catImages.first())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не стыкуются типы, во вью populate принимает Cat

// }
// if (ex is CancellationException) throw ex
//
// CrashMonitor.trackWarning("Error")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

по условиям задачи в CrashMonitor не должны попадать SocketTimeoutException, здесь попадет, плюс не будет тоста по другим эксепшенам, кроме SocketTimeoutException

В остальных случаях логируем исключение в otus.homework.coroutines.CrashMonitor и показываем Toast с exception.message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants