Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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에 문자열로 하드코딩하는 방식은 몇 가지 단점이 있습니다.Result.failure에Exception대신 오류 유형을 나타내는sealed class나enum을 전달하는 것을 고려해보세요. 예를 들어, 다음과 같이 정의할 수 있습니다.이렇게 하면 Repository는 오류의 '종류'만 전달하고, ViewModel이나 UI 계층에서 이 오류 종류에 따라 적절한 문자열 리소스(
R.string.*)를 사용자에게 보여줄 수 있습니다. 이는 역할 분리를 명확히 하고 코드의 테스트 용이성과 유지보수성을 높여줍니다. 이 PR의 범위를 넘어서는 개선일 수 있지만, 장기적인 관점에서 적용을 고려해보시면 좋을 것 같습니다.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.
제가 잘 몰라서 그런데 올바르지 않은 닉네임이랑 이미 사용 중인 닉네임인 경우 각각 오류 처리 흐름이 어떻게 되나요???
이미 사용 중인 경우는 ApiResult.Success이지만 result.data가 없는 건가요??
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.
중복인 경우: ApiResult.Success, result.data = false
규칙에 어긋난 경우: ApiResult.Failure, result.message가 무슨 규칙에 어떻게 어긋났는지 메세지
입니다!
이름 변경 로직 개발할 때 저도 이 부분 로직을 정확히 이해 못했어서 그냥 올바르지 않은 닉네임으로 퉁쳤던거같아요....