code: public static ExceptionInfo createExceptionInfo(final ExceptionCodec exceptionCodec, final Throwable ex)  {
      return ExceptionInfo.newBuilder()
          .setName(ex.getCause() != null ? ex.getCause().toString() : ex.toString())
          .setMessage(StringUtils.isNotEmpty(ex.getMessage()) ? ex.getMessage() : ex.toString())
          .setData(ByteString.copyFrom(exceptionCodec.toBytes(ex)))
          .build();
    }
docs: Create exception info from exception object.
  @param exceptionCodec to encode exception into bytes
  @param ex exception object
  @return ExceptionInfo