code: public static ContextInfo toContextInfo(final ContextBase context, final ExceptionInfo error) {
      final ContextInfo.Builder builder = ContextInfo.newBuilder()
          .setContextId(context.getId())
          .setEvaluatorId(context.getEvaluatorId())
          .setParentId(context.getParentId().orElse(""))
          .setEvaluatorDescriptorInfo(toEvaluatorDescriptorInfo(
              context.getEvaluatorDescriptor()));
      if (error != null) {
        builder.setException(error);
      }
      return builder.build();
    }
docs: Create a context info from a context object with an error.
  @param context object
  @param error info
  @return context info