Skip to content

Commit

Permalink
HLM-3376: throwing exception on invalid recipient type
Browse files Browse the repository at this point in the history
  • Loading branch information
kanishq-egov committed Oct 23, 2023
1 parent 297a028 commit efc7cae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ public interface Constants {
String GET_ID = "getId";
String STAFF = "STAFF";
String FACILITY = "FACILITY";

String INVALID_RECIPIENT_TYPE = "Invalid Recipient Type";
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.egov.common.validator.Validator;
import org.egov.referralmanagement.service.FacilityService;
import org.egov.referralmanagement.util.ValidatorUtil;
import org.egov.tracer.model.CustomException;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

Expand All @@ -24,6 +25,7 @@
import static org.egov.common.utils.CommonUtils.populateErrorDetails;
import static org.egov.common.utils.ValidatorUtils.getErrorForNonExistentEntity;
import static org.egov.referralmanagement.Constants.FACILITY;
import static org.egov.referralmanagement.Constants.INVALID_RECIPIENT_TYPE;
import static org.egov.referralmanagement.Constants.STAFF;

/**
Expand Down Expand Up @@ -63,6 +65,9 @@ public Map<Referral, List<Error>> validate(ReferralBulkRequest request) {
break;
case FACILITY:
addIgnoreNull(facilityIdList, referral.getRecipientId());
break;
default:
throw new CustomException(INVALID_RECIPIENT_TYPE, "Exception : The Recipient Type is invalid.");
}
});

Expand Down

0 comments on commit efc7cae

Please sign in to comment.