diff --git a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/constant/ApplicationErrorCode.java b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/constant/ApplicationErrorCode.java index 56532fdb098..50179b3cfa7 100644 --- a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/constant/ApplicationErrorCode.java +++ b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/constant/ApplicationErrorCode.java @@ -11,7 +11,8 @@ public enum ApplicationErrorCode { APPLICATION_INSERT_EXCEPTION("KER-MSD-101", "Error occurred while inserting application details"), APPLICATION_NOT_FOUND_EXCEPTION("KER-MSD-002", "Application not found"), APPLICATION_REQUEST_EXCEPTION("KER-MSD-201", "Bad Request Found"), - APPLICATION_CONFIG_FETCH_EXCEPTION("KER-MSD-193", "Error occurred while fetching Application config"); + APPLICATION_CONFIG_FETCH_EXCEPTION("KER-MSD-193", "Error occurred while fetching Application config"), + DATA_ALREADY_EXIST_EXCEPTION("KER-MSD-APT", "Center Type already exist"); private final String errorCode; diff --git a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/service/impl/RegistrationCenterTypeServiceImpl.java b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/service/impl/RegistrationCenterTypeServiceImpl.java index 1a4c6e9a547..7a14cd470eb 100644 --- a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/service/impl/RegistrationCenterTypeServiceImpl.java +++ b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/service/impl/RegistrationCenterTypeServiceImpl.java @@ -131,10 +131,11 @@ public CodeAndLanguageCodeID createRegistrationCenterType( ApplicationErrorCode.APPLICATION_INSERT_EXCEPTION.getErrorMessage() + ExceptionUtils.parseException(exception)), "ADM-556"); - throw new MasterDataServiceException(ApplicationErrorCode.APPLICATION_INSERT_EXCEPTION.getErrorCode(), - ApplicationErrorCode.APPLICATION_INSERT_EXCEPTION.getErrorMessage() + throw new MasterDataServiceException( + ApplicationErrorCode.DATA_ALREADY_EXIST_EXCEPTION.getErrorCode(), + ApplicationErrorCode.DATA_ALREADY_EXIST_EXCEPTION.getErrorMessage() + ExceptionUtils.parseException(exception)); - } + } CodeAndLanguageCodeID codeAndLanguageCodeID = new CodeAndLanguageCodeID(); MapperUtils.map(registrationCenterType, codeAndLanguageCodeID); auditUtil.auditRequest(