Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,11 @@ public Dataset createSubEntityDataset(Program program, UUID experimentId, SubEnt

String programDbId = program.getBrapiProgram() != null ? program.getBrapiProgram().getProgramDbId() : null;
HttpResponse<String> levelResponse = observationLevelDAO.createObservationLevelName(program, datasetName, DatasetLevel.SUB_OBS_UNIT, programDbId);
if (levelResponse.getStatus() == HttpStatus.CONFLICT) {
throw new AlreadyExistsException("Dataset name already exists in this experiment");
} else if (levelResponse.getStatus().getCode() < 200 || levelResponse.getStatus().getCode() >= 300) {

// 409 and 200 are expected response codes, anything else error out
// 409 means level already exists so we just use the name in OUs
// 200 means level was created successfully and can use the name in OUs
if (levelResponse.getStatus() != HttpStatus.CONFLICT && levelResponse.getStatus() != HttpStatus.OK) {
throw new ApiException(levelResponse.getStatus().getCode(), "Unable to create observation level: " + levelResponse.getStatus().getReason());
}

Expand Down