fix crash on any error on friends screen other than api error

This commit is contained in:
2024-07-14 01:04:20 +03:00
parent 43fe1832f7
commit 9481541806
@@ -69,25 +69,14 @@ class FriendsViewModelImpl(
friendsUseCase.getAllFriends(count = LOAD_COUNT, offset = offset).listenValue { state -> friendsUseCase.getAllFriends(count = LOAD_COUNT, offset = offset).listenValue { state ->
state.processState( state.processState(
error = { error -> error = { error ->
when (error) { if (error is State.Error.ApiError) {
is State.Error.ApiError -> { when (error.errorCode) {
val (code, message) = error VkErrorCodes.UserAuthorizationFailed -> {
baseError.setValue { BaseError.SessionExpired }
when (code) {
VkErrorCodes.UserAuthorizationFailed -> {
baseError.setValue { BaseError.SessionExpired }
}
else -> {
Unit
}
} }
}
State.Error.ConnectionError -> TODO() else -> Unit
State.Error.InternalError -> TODO() }
is State.Error.OAuthError -> TODO()
State.Error.Unknown -> TODO()
} }
}, },
success = { info -> success = { info ->