public static FragmentInstanceFailureInfo toFragmentInstanceFailureInfo(Throwable throwable) {
    if (throwable == null) {
      return null;
    }
    return new FragmentInstanceFailureInfo(
        throwable.getMessage(),
        toFragmentInstanceFailureInfo(throwable.getCause()),
        Arrays.stream(throwable.getSuppressed())
            .map(FragmentInstanceFailureInfo::toFragmentInstanceFailureInfo)
            .collect(Collectors.toList()),
        Arrays.stream(throwable.getStackTrace()).map(Objects::toString).collect(toImmutableList()));
  }
This class is inspired by Trino <a
href="https://github.com/trinodb/trino/blob/master/core/trino-main/src/main/java/io/trino/execution/ExecutionFailureInfo.java">...</a>.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceFailureInfo.java