0

I'm trying to make a global exception handler, below is the code for that. Other exceptions are getting caught but MissingServletRequestParameterException isn't. I tried overriding handleMissingServletRequestParameter as well but didn't had much success. Any idea why the exception is not handled?

public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {

    @ExceptionHandler(value = {Exception.class})
    public ResponseEntity<Object> handleOtherExceptions(final Exception ex, final WebRequest req) {

        // handle other exceptions
    }

}
  • 1. Is your controller advice able to catch any other exceptions? (try throwing deliberately some exception in your controller method) 2. Does `handleOtherExceptions` catches `MissingServletRequestParameterException` exception. – Hemant Patel Oct 18 '20 at 20:31
  • 1. yes controller advice is able to catch other exceptions like RuntimeException in handleOtherExceptions. 2. no, MissingServletRequestParameterException is not getting caught. – Sanchit Mittal Oct 19 '20 at 15:17

0 Answers0