Skip to content

Commit 9b63a38

Browse files
authored
fix: /reissue api에서 발생한 SecurityCustomException을 처리해줄 수 있도록 한다. (#348)
1 parent 6159860 commit 9b63a38

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

api/src/main/java/com/sponus/sponusbe/global/exception/GlobalExceptionHandler.java

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.sponus.coredomain.domain.common.ApiResponse;
1515
import com.sponus.coredomain.domain.common.BaseErrorCode;
1616
import com.sponus.coredomain.domain.common.GlobalErrorCode;
17+
import com.sponus.coreinfrasecurity.jwt.exception.SecurityCustomException;
1718
import com.sponus.sponusbe.domain.organization.exception.OrganizationErrorCode;
1819

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

38+
@ExceptionHandler({SecurityCustomException.class})
39+
public ApiResponse<Object> handleSecurityCustomException(SecurityCustomException e) {
40+
log.warn(">>>>> SecurityCustomException occurred in servlet: {}", e.getErrorCode());
41+
BaseErrorCode errorCode = e.getErrorCode();
42+
return ApiResponse.onFailure(
43+
errorCode.getCode(),
44+
errorCode.getMessage(),
45+
e.getMessage()
46+
);
47+
}
48+
3749
@ExceptionHandler({CustomException.class})
3850
public ResponseEntity<ApiResponse<Void>> handleCustomException(CustomException e) {
3951
BaseErrorCode errorCode = e.getErrorCode();

0 commit comments

Comments
 (0)