Skip to content

Commit

Permalink
fix: /reissue api에서 발생한 SecurityCustomException을 처리해줄 수 있도록 한다. (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxdjww authored Jul 4, 2024
1 parent 6159860 commit 9b63a38
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.sponus.coredomain.domain.common.ApiResponse;
import com.sponus.coredomain.domain.common.BaseErrorCode;
import com.sponus.coredomain.domain.common.GlobalErrorCode;
import com.sponus.coreinfrasecurity.jwt.exception.SecurityCustomException;
import com.sponus.sponusbe.domain.organization.exception.OrganizationErrorCode;

import lombok.extern.slf4j.Slf4j;
Expand All @@ -34,6 +35,17 @@ public ResponseEntity<ApiResponse<String>> handleAllException(Exception e) {
return ResponseEntity.internalServerError().body(errorResponse);
}

@ExceptionHandler({SecurityCustomException.class})
public ApiResponse<Object> handleSecurityCustomException(SecurityCustomException e) {
log.warn(">>>>> SecurityCustomException occurred in servlet: {}", e.getErrorCode());
BaseErrorCode errorCode = e.getErrorCode();
return ApiResponse.onFailure(
errorCode.getCode(),
errorCode.getMessage(),
e.getMessage()
);
}

@ExceptionHandler({CustomException.class})
public ResponseEntity<ApiResponse<Void>> handleCustomException(CustomException e) {
BaseErrorCode errorCode = e.getErrorCode();
Expand Down

0 comments on commit 9b63a38

Please sign in to comment.