forked from melod1n/fast-messenger
fix crash on any error on friends screen other than api error
This commit is contained in:
@@ -69,26 +69,15 @@ class FriendsViewModelImpl(
|
||||
friendsUseCase.getAllFriends(count = LOAD_COUNT, offset = offset).listenValue { state ->
|
||||
state.processState(
|
||||
error = { error ->
|
||||
when (error) {
|
||||
is State.Error.ApiError -> {
|
||||
val (code, message) = error
|
||||
|
||||
when (code) {
|
||||
if (error is State.Error.ApiError) {
|
||||
when (error.errorCode) {
|
||||
VkErrorCodes.UserAuthorizationFailed -> {
|
||||
baseError.setValue { BaseError.SessionExpired }
|
||||
}
|
||||
|
||||
else -> {
|
||||
Unit
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
State.Error.ConnectionError -> TODO()
|
||||
State.Error.InternalError -> TODO()
|
||||
is State.Error.OAuthError -> TODO()
|
||||
State.Error.Unknown -> TODO()
|
||||
}
|
||||
},
|
||||
success = { info ->
|
||||
val response = info.friends
|
||||
|
||||
Reference in New Issue
Block a user