ARTICLE AD BOX
This is GlobalExceptionClass that helps in handling errors on the frontend.
@RestControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(IllegalArgumentException.class) public ResponseEntity<String> illegalArgumentExceptionHandler(IllegalArgumentException exception){ String error = exception.getMessage(); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error); } }