-
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
[refac] BaseResponse, ExceptionHandler 수정 #32
Conversation
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.
filter 단에서 발생하는 에러도 hankkiResponse 응답구조로 메세지를 전송하게끔 잘 수정하신 것 같아요. 수고하셨습니다~
response.setContentType(MediaType.APPLICATION_JSON_VALUE); | ||
response.setCharacterEncoding("utf-8"); | ||
response.setStatus(httpStatus.value()); | ||
PrintWriter writer = response.getWriter(); | ||
writer.write(objectMapper.writeValueAsString(BaseResponse.of(errorCode))); | ||
writer.write(objectMapper.writeValueAsString(HankkiResponse.fail(authErrorCode))); |
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.
굳굳
response.setContentType(MediaType.APPLICATION_JSON_VALUE); | ||
response.setCharacterEncoding("utf-8"); | ||
response.setStatus(httpStatus.value()); | ||
PrintWriter writer = response.getWriter(); | ||
writer.write(objectMapper.writeValueAsString(BaseResponse.of(errorCode))); | ||
writer.write(objectMapper.writeValueAsString(HankkiResponse.fail(authErrorCode))); |
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.
굳!
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum UserErrorCode implements ErrorCode { |
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.
에러 상황별로 errorCode 클래스 나눠서 관리하는거 너무 좋습니당
@RequiredArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class HankkiResponse<T> { | ||
|
||
private final int status; |
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.
P1
저희 혹시 status는 code로 주기로 하지 않았나요??
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.
반영했습니다.
@@ -52,6 +52,6 @@ private String getToken(final String refreshToken) { | |||
if (refreshToken.startsWith(BEARER)) { | |||
return refreshToken.substring(BEARER.length()); | |||
} | |||
throw new UnauthorizedException(ErrorCode.INVALID_ACCESS_TOKEN); | |||
throw new UnauthorizedException(AuthErrorCode.INVALID_ACCESS_TOKEN); |
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.
P1
리프래시 토큰 검증 과정이라 INVALID_ACCESS_TOKEN은 적절하지 않은 것 같습다
* [refac] create interface for code * [refac] refactor exception and common api response * [feat] create response advice * [refac] fix typo in UserErrorCode.java * [refac] change Hankki response creation logic * [refac] delete duplicated BaseTimeEntity.java * [refac] fix HankkiResponse.java as api spec * [refac] fix unappropriate error message while validating refreshtoken * [refac] change typo in ResponseAdvice.java
Related Issue 📌
close #8
Description ✔️
To Reviewers
전체적인 구조 코드리뷰 부탁드립니다.