[Refactor][Koin Project] HttpException 매핑을 위한 mapHttpFailure 함수 추가 #1255
+123
−250
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.
PR 개요
PR 체크리스트
작업사항
작업사항의 상세한 설명
HttpException을 매핑하기 위한mapHttpFailure함수를 추가했습니다.UserRepository에 적용했습니다.기존의
HttpException을 매핑하는 로직은 다음과 같았습니다.onFailure안에서HttpException을 필터링하고, 다시 status code에 따라 분기처리를 진행하고, else 처리까지 진행했습니다.이와 동일한 코드가 반복되었고, 이는 심각한 코드 중복과 유지 보수의 어려움을 유발했습니다.
따라서,
HttpException을 매핑하기 위한mapHttpFailure함수를 추가하여 이 문제를 해결했습니다.해당 함수를 적용한 코드는 다음과 같습니다.
status code에 맞는 Exception을 parameter로 넘겨주면 mapping이 가능합니다.
선언되지 않은 HttpException일 경우,
KoinUnknownErrorException이 반환됩니다.논의 사항
X
스크린샷
추가내용