/**
   * Build a state object that can be used to submit a stage progress self patch.
   *
   * @param stage
   * @param subStage
   * @param e
   * @return
   */
  private State buildPatch(TaskState.TaskStage stage, TaskState.SubStage subStage, Throwable e) {
    State s = new State();
    s.taskInfo = new TaskState();
    s.taskInfo.stage = stage;
    s.taskInfo.subStage = subStage;

    if (e != null) {
      s.taskInfo.failure = Utils.toServiceErrorResponse(e);
    }

    return s;
  }
 private KubernetesClusterCreateTask buildPatch(
     TaskState.TaskStage stage, TaskState.SubStage subStage, @Nullable Throwable t) {
   return buildPatch(stage, subStage, null == t ? null : Utils.toServiceErrorResponse(t));
 }
 /**
  * This method builds a state object which can be used to submit a stage progress self-patch.
  *
  * @param stage Supplies the stage that the current service instance is moving to.
  * @param e Supplies the exception that the current service instance encountered if any.
  * @return Returns a patch state object that the current service instance is moving to.
  */
 @VisibleForTesting
 protected State buildPatch(TaskState.TaskStage stage, @Nullable Throwable e) {
   return buildPatch(stage, (e != null) ? Utils.toServiceErrorResponse(e) : null);
 }