-
Notifications
You must be signed in to change notification settings - Fork 0
[♻️ refactor] UserName 검증 개선 #36
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
Conversation
BaseException과 Exception 처리만으로 충분하므로, UnsupportedOperationException, HttpMediaTypeNotSupportedException, SocketTimeoutException에 대한 별도 핸들러를 제거함.
- INVALID_USER_NAME 메시지에 공백 허용 여부를 명확히 표현
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.
Pull Request Overview
This PR refactors the user name validation logic and improves error messaging, along with cleaning up unused exception handlers.
- Renamed the null validation method from validateNull to validateNotNull and reordered validation steps.
- Updated the error message for invalid user name format to include the allowance of whitespace.
- Removed redundant exception handler methods from the global exception handler file.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main/java/org/terning/user/domain/vo/UserName.java | Renamed the null check method to validateNotNull and reordered validation calls. |
| src/main/java/org/terning/user/common/failure/UserErrorCode.java | Updated the error message to clearly indicate allowed characters (including whitespace). |
| src/main/java/org/terning/global/failure/GlobalExceptionHandler.java | Removed unused exception handlers for unsupported operations, media type, and socket timeout. |
| USER_NAME_NOT_NULL(HttpStatus.BAD_REQUEST, "이름은 null일 수 없습니다."), | ||
| USER_NAME_LENGTH_EXCEEDED(HttpStatus.BAD_REQUEST, "이름은 공백 포함 12글자를 넘을 수 없습니다."), | ||
| INVALID_USER_NAME(HttpStatus.BAD_REQUEST, "이름의 구성은 문자(한글, 영어), 숫자만 가능합니다."), | ||
| INVALID_USER_NAME(HttpStatus.BAD_REQUEST, "이름은 한글, 영어, 숫자, 공백으로만 구성할 수 있습니다."), |
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.
피드백 반영하여 공백을 포함한 조건으로 수정하였습니다! 덕분에 의미를 더 명확하게 전달할 수 있게 된 것 같아요.
감사합니다 😊
| validateNotNull(value); | ||
| validateInvalidCharacters(value); |
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.
피드백 덕분에 네이밍에도 더 신경 쓸 수 있었던 것 같아요!
감사합니다 🙏
📄 Work Description
UserNameVO에서 null 검증 메서드 이름을validateNull→validateNotNull로 변경하여 메서드 역할을 명확히 했습니다.UserErrorCode의 에러 메시지를 상황에 맞게 개선했습니다.💬 To Reviewers
📷 Screenshot
⚙️ ISSUE
✅ PR check list