stop method

  1. @override
Future<StudyDeploymentStatus> stop(
  1. String studyDeploymentId
)
override

Permanently stop the study deployment with the specified studyDeploymentId. No further changes to this deployment will be allowed and no more data will be collected.

Implementation

@override
Future<StudyDeploymentStatus> stop(String studyDeploymentId) async {
  StudyDeploymentStatus? status;
  if (isConfigured()) {
    try {
      status = await CarpDeploymentService().stop(studyDeploymentId);
    } on CarpServiceException catch (cse) {
      // a CarpServiceException is typically because the deployment is already stopped
      warning('$runtimeType - $cse');
      status = await getStudyDeploymentStatus(studyDeploymentId);
    } catch (error) {
      // other errors can be rethrown
      rethrow;
    }
  }
  if (status != null)
    return status;
  else
    throw CarpBackendException(
        "Could not stop study deployment in $runtimeType - id: '$studyDeploymentId'");
}