public static Errors forException(final Throwable t) {
        Class<?> clazz = t.getClass();
        while (clazz != null) {
            final Errors error = classToError.get(clazz);
            if (error != null) {
                return error;
            }
            clazz = clazz.getSuperclass();
        }
        LOG.error("Unexpected error: {}.", StackTraceUtil.stackTrace(t));
        return UNKNOWN_SERVER_ERROR;
    }
Return the error instance associated with this exception or any of its superclasses (or UNKNOWN if there is none).
If there are multiple matches in the class hierarchy, the first match starting from the bottom is used.
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/errors/Errors.java