-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
네트워크 에러 핸들링 #164
네트워크 에러 핸들링 #164
Conversation
|
||
@Qualifier | ||
annotation class ErrorInterceptor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파일 이름을 일반적인 인터셉터 이름으로 고치거나, 어노테이션을 별도 클래스로 분리하면 좋을 것 같아
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿굿
추가로 11.24(금) 아침에 논의 했던, 이에 대해서 automaticallyLogin 호출 테스트로, 개발한 예외 처리 동작 잘 되는지 확인하였습니다~ |
protected fun fetchCtErrorMessageId(ctErrorType: CtErrorType): Int { | ||
return when (ctErrorType) { | ||
CtErrorType.DUPLICATED_NICKNAME -> R.string.error_message_duplicated_nickname | ||
CtErrorType.WRONG_TOKEN -> R.string.error_message_wrong_token | ||
CtErrorType.SERVER -> R.string.error_message_server | ||
CtErrorType.CONNECTION -> R.string.error_message_connection | ||
CtErrorType.IO -> R.string.error_message_io | ||
CtErrorType.SSL_HAND_SHAKE -> R.string.error_message_ssl_hand_shake | ||
CtErrorType.UN_KNOWN -> R.string.error_message_un_known | ||
CtErrorType.UN_AUTHORIZED -> R.string.error_message_un_authorized | ||
CtErrorType.NOT_EXIST_PLAYLIST_ON_USER -> R.string.error_message_not_exist_playlist_on_user | ||
CtErrorType.NOT_EXIST_MUSIC -> R.string.error_message_not_exist_music | ||
CtErrorType.ALREADY_ADDED -> R.string.error_message_already_added | ||
CtErrorType.INVALID_INPUT_VALUE -> R.string.error_message_invalid_input_value | ||
CtErrorType.NOT_EXIST_USER -> R.string.error_message_not_exist_user | ||
CtErrorType.ALREADY_EXIST_EMAIL -> R.string.error_message_already_exist_email | ||
CtErrorType.NOT_EXIST_GENRE -> R.string.error_message_not_exist_genre | ||
CtErrorType.EXPIRED_TOKEN -> R.string.error_message_expired_token | ||
CtErrorType.SERVICE -> R.string.error_message_service | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 이부분이 부모 클래스에 있는 것 보다는 다른 파일로 분리해서 이 역할을 따로 분리했으면 좋겠다는 생각이드네용! 확장함수를 사용해도 좋을 것 같아요
is LoginEvent.ShowMessage -> { | ||
val messageId = fetchCtErrorMessageId(event.error) | ||
showMessage(messageId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
위에 코멘트 반영해서 showMessage(event.error.toMsgId())
하면 가독성이 더 좋아질 것 같아요🙂
if (throwable is CtException) { | ||
_events.emit(LoginEvent.ShowMessage(throwable.ctError)) | ||
val ctError = throwable.ctError | ||
if (ctError == CtErrorType.NOT_EXIST_USER || ctError == CtErrorType.WRONG_TOKEN) { | ||
_events.emit(LoginEvent.NavigateToNickName(token)) | ||
} | ||
} else { | ||
_events.emit(LoginEvent.ShowMessage(CtErrorType.UN_KNOWN)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 로직을 위에 exception Handler 에 포함시켜도 되지 않을까요?? 조건문 하나 빼고는 위에 로직이랑 같은 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정말 많은 고민이 담긴 코드 같아 보이네요 ㅎㅎ!! 고생하셨어요!@@ 👏🏻
Issue
Overview
android/feature/111_
이름으로 branch 다시 파서 PR 남깁니다.