-
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
에러 핸들링 관련 리팩터링 및 에러 코드를 추가합니다. #35
Conversation
62602b1
to
b3521bb
Compare
b3521bb
to
8bd3d80
Compare
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.
추가로 돌봄급구 서비스단에서 사용하던 시간 포맷 함수도 common에 추가하고 모두 util 함수로 이용하도록 수정했습니다.
@barabobBOB 앗... 요것은 제 브랜치인데 ㅋㅋㅋ 원래는 크게 상관 없지만 요 브랜치에 의존하는 PR들이 좀 있어서.. 다음엔 따로 PR 파서 진행 부탁드려요! |
@litsynp 헉 알겠습니다..! |
@barabobBOB 괜찮아요~ 괜찮으면 어프룹 부탁드립니다 🙇 |
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.
기존보다 훨씬 에러코드가 명시적이여서 좋네요 :)
🙇 |
에러 핸들링 관련 리팩터링 및 에러 코드를 추가합니다.
이제 message 외에
code
라는 필드를 Error Response로 같이 반환합니다.pnd
패키지에서 enum으로 관리합니다.chi/render를 사용하며,
render.Renderer
인터페이스를 구현하는 커스텀 에러인AppError
를 추가합니다.에러의 정확한 원인에서부터 status code를 유추할 때가 많아 그냥 repository 단부터 AppError를 반환합니다. 좋은 패턴이라고 생각하진 않지만 일단 편의를 위해서... 더 좋은 방향은 추후 생각해보면 좋을 것 같습니다.
database/sql의 PG Error은
FromPGError(err errror)
내에서strings.Contains
로 처리합니다.