private static <T extends Exception> T setExceptionDetails(final T exception,
    final ForeignExceptionMessage eem) {
    final GenericExceptionMessage gem = eem.getGenericException();
    final StackTraceElement[] trace = toStackTrace(gem.getTraceList());
    exception.setStackTrace(trace);
    return exception;
  }
Helper to convert Exceptions and StackTraces from/to protobuf. (see ErrorHandling.proto for the
internal of the proto messages)
hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/util/ForeignExceptionUtil.java