public static String getRedirectUrlWithError(final String originalRedirectUrl, final String errorCode,
                                                 final WebContext webContext) {
        return FunctionUtils.doUnchecked(() -> {
            val uriBuilder = new URIBuilder(originalRedirectUrl).addParameter(OAuth20Constants.ERROR, errorCode);
            webContext.getRequestParameter(OAuth20Constants.STATE).ifPresent(st -> uriBuilder.addParameter(OAuth20Constants.STATE, st));
            return uriBuilder.build().toASCIIString();
        });
    }
Gets redirect url with error.

@param originalRedirectUrl the original redirect url
@param errorCode           the error code
@param webContext          the web context
@return the redirect url with error
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/util/OidcRequestSupport.java