code: public Stage rerunStage(String pipelineName, Integer pipelineCounter, String stageName, HttpOperationResult result) {
          String identifier = StringUtils.join(Arrays.asList(pipelineName, pipelineCounter, stageName), "/");
          HealthStateType healthStateType = HealthStateType.general(HealthStateScope.forStage(pipelineName, stageName));
          Stage stage = null;
  
          try {
              stage = rerunStage(pipelineName, pipelineCounter, stageName, new ResultUpdatingErrorHandler(result));
  
              if (result.isSuccess()) { // this check is for clarity, but is not needed as failures result in RunTimeExceptions
                  result.accepted(String.format("Request to schedule stage %s accepted", identifier), "", healthStateType);
              }
          } catch (RuntimeException e) {
              // if the result is successful, but there's still an exception, treat it as a 500
              // else the result is assumed to contain the right status code and error message
              if (result.isSuccess()) {
                  String message = String.format(
                          "Stage rerun request for stage [%s] could not be completed " +
                                  "because of an unexpected failure. Cause: %s", identifier,
                          e.getMessage()
                  );
                  LOGGER.error(message, e);
                  result.internalServerError(message, healthStateType);
              }
          }
          return stage;
      }
docs: Top-level operation only; consumes exceptions