public static ModelAndView produceErrorView(final String view, final Throwable e) {
        val rootCause = (e instanceof final RuntimeException er && er.getCause() != null)
            ? ExceptionUtils.getRootCause(e)
            : e;
        val mv = new ModelAndView(view, CollectionUtils.wrap(CasWebflowConstants.ATTRIBUTE_ERROR_ROOT_CAUSE_EXCEPTION, rootCause));
        mv.setStatus(HttpStatus.BAD_REQUEST);
        LoggingUtils.error(LOGGER, e);
        return mv;
    }
Produce error view model and view.

@param view the view
@param e    the e
@return the model and view
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java