src/main/java/com/latincoder/sbconcurrent/configuration/RestExceptionInterceptor.java
@ExceptionHandler
    public ResponseEntity<Map<Object, Object>> processSupportedExceptions(Throwable throwable) {
        Optional<ResponseEntity<Map<Object, Object>>> supportedException = Arrays.stream(SupportedException.values())
                .filter(supportedEx -> hasSameClass(supportedEx, throwable))
                .map(this::createResponseEntityFromException)
                .findFirst();

        // return the matching supportedException if present, if not, respond with INTERNAL_SERVER_ERROR
        return supportedException.orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
    }
/**
     * This ExceptionHandler will catch the exceptions throwned (hence receives {@link Throwable})
     * from all RestController's, including {@link com.latincoder.sbconcurrent.controllers.Students}
     * Then verifies if this throwable is in fact an Exception Supported by this application, for
     * a list of SupportedExceptions see {@link SupportedException}
     *
     * @param throwable
     * @return
     */
This ExceptionHandler will catch the exceptions throwned (hence receives  Throwable)
from all RestController's, including  com.latincoder.sbconcurrent.controllers.Students
Then verifies if this throwable is in fact an Exception Supported by this application, for
a list of SupportedExceptions see  SupportedException

@param throwable
@return
This ExceptionHandler will catch the exceptions throwned ( hence receives Throwable ) from all RestController ' s including com . latincoder . sbconcurrent . controllers . Students Then verifies if this throwable is in fact an Exception Supported by this application for a list of SupportedExceptions see SupportedException @param throwable @return
@ExceptionHandler
    public ResponseEntity<Map<Object, Object>> processSupportedExceptions(Throwable throwable) {
        Optional<ResponseEntity<Map<Object, Object>>> supportedException = Arrays.stream(SupportedException.values())
                .filter(supportedEx -> hasSameClass(supportedEx, throwable))
                .map(this::createResponseEntityFromException)
                .findFirst();
        return supportedException.orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
    }
@ ExceptionHandler public ResponseEntity < Map < Object , Object > > processSupportedExceptions ( Throwable throwable ) { Optional < ResponseEntity < Map < Object , Object > > > supportedException = Arrays . stream ( SupportedException . values ( ) ) . filter ( supportedEx -> hasSameClass ( supportedEx , throwable ) ) . map ( this :: createResponseEntityFromException ) . findFirst ( ) ; return supportedException . orElseGet ( ( ) -> new ResponseEntity < > ( HttpStatus . INTERNAL_SERVER_ERROR ) ) ; }
This ExceptionHandler will catch the exceptions throwned (hence receives {@link Throwable})
 from all RestController's, including {@link com.latincoder.sbconcurrent.controllers.Students}
 Then verifies if this throwable is in fact an Exception Supported by this application, for
 a list of SupportedExceptions see {@link SupportedException}
This ExceptionHandler will catch the exceptions throwned ( hence receives { @link Throwable } ) from all RestController ' s including { @link com . latincoder . sbconcurrent . controllers . Students } Then verifies if this throwable is in fact an Exception Supported by this application for a list of SupportedExceptions see { @link SupportedException }
// return the matching supportedException if present, if not, respond with INTERNAL_SERVER_ERROR