protected static void throwException(final Throwable exception, final HttpServletResponse servletResponse,
                                         final HttpServletRequest servletRequest) {
        LoggingUtils.error(LOGGER, exception);
        if (servletResponse != null) {
            if (exception instanceof UnauthorizedServiceException) {
                servletResponse.setStatus(HttpStatus.FORBIDDEN.value());
            }
            val nsce = (RuntimeException) getRootCause(exception, NoSuchConversationException.class);
            if (nsce != null) {
                servletRequest.setAttribute(RequestDispatcher.ERROR_EXCEPTION, nsce);
                throw nsce;
            }
        }
        throw exception instanceof final RuntimeException re ? re : new RuntimeException(exception);
    }
This is {@link AbstractSecurityFilter}.

@author Misagh Moayyed
@since 6.1.0
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/filters/AbstractSecurityFilter.java