@ ExceptionHandler ( AbstractServerRtException . class ) public ResponseEntity < ExceptionInfo > handleSpServerRtExceptions ( final HttpServletRequest request , final Exception ex ) { logRequest ( request , ex ) ; final ExceptionInfo response = createExceptionInfo ( ex ) ; final HttpStatus responseStatus ; if ( ex instanceof AbstractServerRtException ) { responseStatus = getStatusOrDefault ( ( ( AbstractServerRtException ) ex ) . getError ( ) ) ; } else { responseStatus = DEFAULT_RESPONSE_STATUS ; } return new ResponseEntity <> ( response , responseStatus ) ; }
method for handling exception of type AbstractServerRtException . Called by the Spring - Framework for exception handling .