Class ExceptionAdvice
java.lang.Object
info.ejava.examples.common.web.BaseExceptionAdvice
info.ejava.examples.db.validation.contacts.controller.ExceptionAdvice
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<MessageDTO> handle
(jakarta.validation.ConstraintViolationException ex) Spring will throw a ConstraintViolationException when failing validation for non-@RequestBody paramters or vanilla non-HTTP AOP calls.org.springframework.http.ResponseEntity
<MessageDTO> handle
(org.springframework.web.bind.MethodArgumentNotValidException ex) This exception is thrown when an HTTP/Controller method fails validation during for @RequestBody parameters.Methods inherited from class info.ejava.examples.common.web.BaseExceptionAdvice
buildResponse, getMethod, getPrincipal, handle, handle, handle, handle, handle, handle, handle, handleRuntimeException
-
Constructor Details
-
ExceptionAdvice
public ExceptionAdvice()
-
-
Method Details
-
handle
@ExceptionHandler(jakarta.validation.ConstraintViolationException.class) public org.springframework.http.ResponseEntity<MessageDTO> handle(jakarta.validation.ConstraintViolationException ex) Spring will throw a ConstraintViolationException when failing validation for non-@RequestBody paramters or vanilla non-HTTP AOP calls. -
handle
@ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class) public org.springframework.http.ResponseEntity<MessageDTO> handle(org.springframework.web.bind.MethodArgumentNotValidException ex) This exception is thrown when an HTTP/Controller method fails validation during for @RequestBody parameters.- Parameters:
ex
-- Returns:
- response entity with error message
-