public Optional<T> validate() {
        if (!isBroken()) {
            return getResult();
        } else {
            throw new ValidatedResultException(events);
        }
    }
Get the optional result, and throw if there are any ERROR events.

@return Returns the optional result.
@throws ValidatedResultException if there are any ERROR events.
smithy-model/src/main/java/software/amazon/smithy/model/validation/ValidatedResult.java