public String getCode() {
        val cause = this.getCause();
        if (cause instanceof final RootCasException rce) {
            return rce.getCode();
        }
        return this.code;
    }
If there is a chained exception it recursively
calls {@code getCode()} on the cause of the chained exception rather than the returning
the code itself.

@return Returns the code.
api/cas-server-core-api-authentication/src/main/java/org/apereo/cas/authentication/RootCasException.java