Skip to content

Commit

Permalink
refactor: IllegalArgumentException 예외 핸들러 메서드 추가 (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdkdhoho committed Sep 2, 2024
1 parent 8b8e7a7 commit bcb41b6
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.jsonwebtoken.security.SignatureException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
Expand All @@ -34,6 +35,12 @@ protected ResponseEntity<String> handleException(Exception e) {
return ResponseEntity.status(INTERNAL_SERVER_ERROR).body(e.getMessage());
}

@ExceptionHandler(IllegalArgumentException.class)
ResponseEntity<String> handleIllegalArgumentException(IllegalArgumentException e) {
log.error("[IllegalArgumentException] : {}", e.getMessage(), e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage());
}

@ExceptionHandler(MethodArgumentTypeMismatchException.class)
ResponseEntity<ErrorResponse> handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e) {
log.error("[MethodArgumentTypeMismatchException] : {}", e.getMessage(), e);
Expand Down

0 comments on commit bcb41b6

Please sign in to comment.