Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,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.HandlerMethodValidationException;

import jakarta.servlet.ServletException;
import jakarta.validation.ConstraintViolationException;
Expand All @@ -26,6 +27,13 @@ public ResponseEntity<ApiExceptionBody> handleValidationException(final Constrai
.body(ApiExceptionBody.of(1000, exception.getMessage()));
}

@ExceptionHandler(HandlerMethodValidationException.class)
public ResponseEntity<ApiExceptionBody> handleValidationException(final HandlerMethodValidationException exception) {
log.warn("[ApiExceptionHandler] wrong arguments: {}", exception.getCrossParameterValidationResults(), exception);
return ResponseEntity.status(API_EXCEPTION_STATUS)
.body(ApiExceptionBody.of(1000, exception.getMessage()));
}

@ExceptionHandler({ServletException.class, HttpMessageNotReadableException.class, MethodArgumentNotValidException.class})
public ResponseEntity<ApiExceptionBody> handleServletException(final Exception exception) {
log.warn("[ApiExceptionHandler] wrong api access with: {}", exception.getMessage(), exception);
Expand Down