Skip to content

Commit

Permalink
feat: RequestParam 에 잘못된 포맷으로 와서 TypeMismatch 날 때, 400 처리하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sakjung committed Mar 14, 2023
1 parent 13c80f1 commit 41f3590
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -80,7 +81,7 @@ public ResponseEntity<ErrorResponse> invalidParamHandler(final ConstraintViolati
return ResponseEntity.badRequest().body(ErrorResponse.from(exception));
}

@ExceptionHandler({InvalidFormatException.class, HttpMessageNotReadableException.class})
@ExceptionHandler({InvalidFormatException.class, HttpMessageNotReadableException.class, MethodArgumentTypeMismatchException.class})
public ResponseEntity<ErrorResponse> invalidFormatHandler(final Exception exception) {
logInfo(exception);
return ResponseEntity.badRequest().body(ErrorResponse.invalidFormat());
Expand Down

0 comments on commit 41f3590

Please sign in to comment.