@Override
    public ModelAndView resolveErrorView(final HttpServletRequest request,
                                         final HttpStatus status,
                                         final Map<String, Object> map) {
        val errorContext = new ErrorContext(request, status, map);
        val defaultModelAndView = defaultFallback.apply(errorContext)
            .orElseGet(() -> super.resolveErrorView(request, status, map));
        val exception = (Exception) request.getAttribute("jakarta.servlet.error.exception");
        val rootCause = ExceptionUtils.getRootCause(exception);
        if (exception != null) {
            return mappings.entrySet()
                .stream()
                .filter(entry -> entry.getKey().isAssignableFrom(exception.getClass())
                    || (rootCause != null && entry.getKey().isAssignableFrom(rootCause.getClass())))
                .map(Map.Entry::getValue)
                .peek(mv -> mv.getModelMap().putAll(CollectionUtils.wrap(CasWebflowConstants.ATTRIBUTE_ERROR_ROOT_CAUSE_EXCEPTION,
                    Objects.requireNonNullElse(rootCause, exception))))
                .findFirst()
                .orElse(defaultModelAndView);
        }
        return defaultModelAndView;
    }
This is {@link MappedExceptionErrorViewResolver}.

@author Misagh Moayyed
@since 7.0.0
core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/support/MappedExceptionErrorViewResolver.java