default String translateException(final RequestContext requestContext, final Exception exception) {
        if (exception instanceof final AuthenticationException authenticationException) {
            val values = authenticationException.getHandlerErrors().values().stream().map(Throwable::getClass).toList();
            val handlerErrorName = getRegisteredExceptions()
                .stream()
                .filter(values::contains)
                .map(Class::getSimpleName)
                .findFirst()
                .orElseGet(() -> {
                    LOGGER.debug("Unable to translate handler errors of the authentication exception [{}]. Returning [{}]", exception, UNKNOWN);
                    return UNKNOWN;
                });
            val messageCode = MessageBundleProperties.DEFAULT_BUNDLE_PREFIX_AUTHN_FAILURE + handlerErrorName;
            WebUtils.addErrorMessageToContext(requestContext, messageCode,
                StringUtils.EMPTY, authenticationException.getArgs().toArray());
            return handlerErrorName;
        }

        if (exception instanceof final AbstractTicketException e) {
            val match = getRegisteredExceptions().stream()
                .filter(ex -> ex.isInstance(e)).map(Class::getSimpleName)
                .findFirst();
            WebUtils.addErrorMessageToContext(requestContext, e.getCode(),
                StringUtils.EMPTY, e.getArgs().toArray());
            return match.orElse(CasWebflowExceptionCatalog.UNKNOWN);
        }
        return UNKNOWN;
    }
Translate exception.

@param requestContext the request context
@param exception      the exception
@return the string
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/authentication/CasWebflowExceptionCatalog.java