in ratis-logservice/src/main/java/org/apache/ratis/logservice/util/MetaServiceProtoUtil.java [160:179]
public static IOException toMetaServiceException(MetaServiceExceptionProto exceptionProto) {
try {
final IOException result;
Class<?> clazz = Class.forName(exceptionProto.getExceptionClassName());
Exception e = ReflectionUtils.instantiateException(
clazz.asSubclass(Exception.class), exceptionProto.getErrorMsg());
if(e instanceof IOException) {
result = (IOException)e;
} else {
result = new IOException(e);
}
StackTraceElement[] stacktrace =
(StackTraceElement[]) ProtoUtils.toObject(exceptionProto.getStacktrace());
result.setStackTrace(stacktrace);
return result;
} catch (Exception e) {
throw new RuntimeException(e);
}
}