private static Throwable checkSerializable(Throwable throwable) {
    try (ObjectOutputStream oos = new ObjectOutputStream(new ByteArrayOutputStream())) {
      oos.writeObject(throwable);
      return throwable;

    } catch (IOException e) {
      StringWriter sw = new StringWriter();
      e.printStackTrace(new PrintWriter(sw, true));
      return new IOException(sw.toString());
    }
  }
Returns whether or not an exception occurred while invoking the method
geode-dunit/src/main/java/org/apache/geode/test/dunit/internal/MethodInvokerResult.java