Skip to content

Commit

Permalink
chore: log level info 로 변경 및 stack trace 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
kckc0608 committed Dec 31, 2024
1 parent 51632c3 commit 5fed433
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {

@ExceptionHandler(CustomException.class)
public ResponseEntity<ErrorResponse> handleCustomException(CustomException e) {
log.error("CustomException : {}", e.getMessage(), e);
log.info("CustomException : {}", e.getMessage());
return ResponseEntity.status(e.getErrorCode().getStatus()).body(ErrorResponse.of(e.getErrorCode()));
}

@ExceptionHandler(CustomPaymentException.class)
public ResponseEntity<ErrorResponse> handleCustomPaymentException(CustomPaymentException e) {
log.error("CustomPaymentException : {}, {}", e.getCode(), e.getMessage());
log.info("CustomPaymentException : {}, {}", e.getCode(), e.getMessage());
return ResponseEntity.status(e.getStatus()).body(ErrorResponse.of(e.getCode(), e.getMessage()));
}

@ExceptionHandler(Exception.class)
public ResponseEntity<ErrorResponse> handleException(Exception e) {
log.error("INTERNAL_SERVER_ERROR : {}", e.getMessage(), e);
log.error("INTERNAL_SERVER_ERROR : {}", e.getMessage());
return ResponseEntity.status(ErrorCode.INTERNAL_SERVER_ERROR.getStatus())
.body(ErrorResponse.of(ErrorCode.INTERNAL_SERVER_ERROR));
}

@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(
MethodArgumentNotValidException e, HttpHeaders headers, HttpStatusCode status, WebRequest request) {
log.error("METHOD_ARGUMENT_NOT_VALID : {}", e.getMessage(), e);
log.info("METHOD_ARGUMENT_NOT_VALID : {}", e.getMessage());
String errorMessage = e.getBindingResult().getAllErrors().get(0).getDefaultMessage();
return ResponseEntity.status(status.value())
.body(ErrorResponse.of(ErrorCode.METHOD_ARGUMENT_NOT_VALID, errorMessage));
Expand Down

0 comments on commit 5fed433

Please sign in to comment.