Skip to content
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

refactor: security 모듈 CustomException 정의 및 ErrorCode 정리 #159

Merged
merged 6 commits into from
Jan 8, 2024

Conversation

eunbc
Copy link
Collaborator

@eunbc eunbc commented Jan 8, 2024

구현 기능

  • security - RuntimeException -> SecurityCustomException 으로 변경
  • ErrorCode 분류 및 미사용 에러코드 삭제
  • HttpResponseUtil 적용

resolve: #156

@eunbc eunbc added refactor 리팩터링 member 회원 labels Jan 8, 2024
@eunbc eunbc requested a review from kimday0326 January 8, 2024 06:52
@eunbc eunbc self-assigned this Jan 8, 2024
Copy link
Member

@kimday0326 kimday0326 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

훨씬 깔끔해졌네요 감사합니다! 머지하겠습니다!

Comment on lines +32 to +40
protected ResponseEntity<ErrorResponse> handleMemberCustomException(CustomException ex) {
log.warn(">>>>> MemberCustomException : {}", ex);
BaseErrorCode errorCode = ex.getErrorCode();
return ResponseEntity.status(errorCode.getStatus()).body(errorCode.getErrorResponse());
}

@ExceptionHandler(SecurityCustomException.class)
protected ResponseEntity<ErrorResponse> handleSecurityCustomException(SecurityCustomException ex) {
log.warn(">>>>> SecurityCustomException : {}", ex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 감사합니다!

Comment on lines -31 to +35
public static void setErrorResponse(HttpServletResponse response, HttpStatus httpStatus)
public static void setErrorResponse(HttpServletResponse response, HttpStatus httpStatus, Object body)
throws IOException {
String responseBody = objectMapper.writeValueAsString(
new ErrorResponse(httpStatus.name(), httpStatus.getReasonPhrase()));
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setStatus(httpStatus.value());
response.setCharacterEncoding("UTF-8");
response.getWriter().write(responseBody);
objectMapper.writeValue(response.getOutputStream(), body);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정해주셔서 감사합니다!🙇‍♀️

@kimday0326 kimday0326 merged commit 39b064d into main Jan 8, 2024
1 check passed
@kimday0326 kimday0326 deleted the member/156 branch January 8, 2024 10:58
park0jae pushed a commit that referenced this pull request Jan 9, 2024
* refactor: ErrorCode 정리

* refactor: HttpResponseUtil 적용

* refactor: SecurityCustomException 생성, 적용

* refactor: GlobalExceptionHandler 리팩터링

---------

Co-authored-by: Kim Dae Hwi <[email protected]>
park0jae pushed a commit that referenced this pull request Jan 9, 2024
* fix: api 이름 변경

* feat : 실시간 검색 기능 구현 - Aggregation 제외

* feat: #151 실시간 검색 document 추가, 쿼리 작성

* test: 멤버 도메인 test.http 파일 작성 (#149)

* test: member 관련 http 테스트 추가

* test: 슈퍼관리자, 관리자 http 테스트 추가

---------

Co-authored-by: 조은비 <[email protected]>

* refactor: 공통 BaseErrorCode 정의 (#153)

Co-authored-by: 조은비 <[email protected]>

* fix: CustomException의 필드를 BaseErrorCode로 변경 (#155)

* fix: CustomException의 필드를 BaseErrorCode로 변경

* fix: BaseErrorCode 수정

* feat: 이탈된 예매에 대한 좌석 상태 변경 배치 (#157)

* feat: 이탈된 예매에 대한 좌석 상태 변경 배치

* chore

---------

Co-authored-by: byulcode <[email protected]>

* docs: 예매 http 작성 (#161)

* docs: http 유저 시나리오 작성

* fix: createBooking에서 세션 아이디 삭제하는 로직 비동기 메서드로 분리

* docs: http 작성

* refactor: security 모듈 CustomException 정의 및 ErrorCode 정리  (#159)

* refactor: ErrorCode 정리

* refactor: HttpResponseUtil 적용

* refactor: SecurityCustomException 생성, 적용

* refactor: GlobalExceptionHandler 리팩터링

---------

Co-authored-by: Kim Dae Hwi <[email protected]>

* feat: #151 aggregation 구현, source 포함 조건 추가

---------

Co-authored-by: Kim Dae Hwi <[email protected]>
Co-authored-by: 조은비 <[email protected]>
Co-authored-by: Hanna Lee <[email protected]>
Co-authored-by: byulcode <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
member 회원 refactor 리팩터링
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

refactor: security 모듈 CustomException 정의 및 ErrorCode 정리
2 participants