Error Handling
@ControllerAdvice
public final class ControllerExceptionHandler {
// More code
@ExceptionHandler(IllegalArgumentException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ResponseBody
public final ErrorResponse processIllegalArgument(final IllegalArgumentException ex) {
LOGGER.debug("Intercepted IllegalArgumentException");
return new DefaultErrorResponse(resolveLocalizedErrorMessage(ex.getMessage()));
}
// More Code
}Default Implementation
Last updated