Skip to content

Commit ef67f21

Browse files
committed
[BOOK-367] fix: 로그인 API 에러 처리 방식 개선
누락된 ErrorScope.Login + Dialog 에러 처리 적용
1 parent 207b101 commit ef67f21

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

feature/login/src/main/kotlin/com/ninecraft/booket/feature/login/LoginPresenter.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import androidx.compose.runtime.mutableStateOf
66
import androidx.compose.runtime.rememberCoroutineScope
77
import androidx.compose.runtime.setValue
88
import com.ninecraft.booket.core.common.analytics.AnalyticsHelper
9+
import com.ninecraft.booket.core.common.constants.ErrorScope
10+
import com.ninecraft.booket.core.common.utils.postErrorDialog
911
import com.ninecraft.booket.core.data.api.repository.AuthRepository
1012
import com.ninecraft.booket.core.data.api.repository.UserRepository
1113
import com.ninecraft.booket.feature.screens.HomeScreen
@@ -60,10 +62,11 @@ class LoginPresenter @AssistedInject constructor(
6062
}
6163
}
6264
}.onFailure { exception ->
63-
exception.message?.let { Logger.e(it) }
64-
sideEffect = exception.message?.let {
65-
LoginSideEffect.ShowToast(it)
66-
}
65+
Logger.e(exception.message ?: "Failed to get user profile")
66+
postErrorDialog(
67+
errorScope = ErrorScope.LOGIN,
68+
exception = exception,
69+
)
6770
}
6871
}
6972
}
@@ -89,11 +92,12 @@ class LoginPresenter @AssistedInject constructor(
8992
.onSuccess {
9093
navigateAfterLogin()
9194
}.onFailure { exception ->
92-
exception.message?.let { Logger.e(it) }
95+
Logger.e(exception.message ?: "Login failed")
9396
analyticsHelper.logEvent(EVENT_ERROR_LOGIN)
94-
sideEffect = exception.message?.let {
95-
LoginSideEffect.ShowToast(it)
96-
}
97+
postErrorDialog(
98+
errorScope = ErrorScope.LOGIN,
99+
exception = exception,
100+
)
97101
}
98102
} finally {
99103
isLoading = false

0 commit comments

Comments
 (0)