refactor(mypage): 마이페이지 api 에러처리 리팩토링 및 scroll 이슈 수정#351
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the MyPage feature by centralizing success and error messages into a dedicated constants file and enhancing the throwApiError utility to support status-specific overrides. It also improves the tab scrolling logic in TabWrapper and updates various hooks to use centralized API calls. The review feedback focuses on improving the consistency and safety of error handling across all mutations by utilizing the getUserErrorMessage utility instead of directly accessing error.message, which ensures a fallback message is provided if the error object is malformed.
| onError: (error) => { | ||
| handleShowToast({ | ||
| message: "프로필 수정에 실패했습니다.\n잠시 후 다시 시도해주세요.", | ||
| message: error.message, |
There was a problem hiding this comment.
에러 처리의 일관성과 안전성을 위해 error.message를 직접 사용하는 대신, useUploadProfileImage에서와 같이 getUserErrorMessage 유틸리티를 사용하는 것이 좋습니다. 이는 네트워크 에러 등 Error 객체가 아닌 예외가 발생했을 때 런타임 에러를 방지하고, 정의된 폴백 메시지를 안전하게 보여줄 수 있게 합니다. 이 파일 내의 다른 onError 핸들러들에도 동일한 패턴을 적용해 주세요.
| message: error.message, | |
| message: getUserErrorMessage(error, MYPAGE_MESSAGES.updateProfileError), |
|
🧷 Preview: https://reboot-f8szwl9se-code-base.vercel.app |
|
🧷 Preview: https://reboot-mrilsc908-code-base.vercel.app |
🛠️ 설명 (Description)
마이페이지 api 에러처리 및 에러 메세지 노출 방식을 일관성 있도록 변경하고
scroll 시 탭 영역으로 강제이동 되는 이슈 수정
📝 변경 사항 요약 (Summary)
💁 변경 사항 이유 (Why)
✅ 테스트 계획 (Test Plan)
statusMessages에 해당 status가 있으면 응답 바디 message보다 우선한다항목입니다.🔗 관련 이슈 (Related Issues)
☑️ 체크리스트 (Checklist)
👀 리뷰어를 위한 참고 사항 (Notes for Reviewers)
➕ 추가 정보 (Additional Information)