adamsaghy commented on code in PR #3232:
URL: https://github.com/apache/fineract/pull/3232#discussion_r1219705954


##########
fineract-core/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java:
##########
@@ -443,51 +430,32 @@ private void validateNameParts(final 
List<ApiParameterError> dataValidationError
         }
     }
 
-    private void validateActivationDate(final List<ApiParameterError> 
dataValidationErrors) {
+    private void validateActivationDate() {
 
         if (getSubmittedOnDate() != null && 
isDateInTheFuture(getSubmittedOnDate())) {
-
-            final String defaultUserMessage = "submitted date cannot be in the 
future.";
-            final ApiParameterError error = 
ApiParameterError.parameterError("error.msg.clients.submittedOnDate.in.the.future",
-                    defaultUserMessage, 
ClientApiConstants.submittedOnDateParamName, this.submittedOnDate);
-
-            dataValidationErrors.add(error);
+            throw new 
InvalidClientActivationDateException("submittedOnDate.in.the.future", 
"submitted date cannot be in the future.",
+                    getSubmittedOnDate());
         }
 
         if (getActivationLocalDate() != null && getSubmittedOnDate() != null 
&& getSubmittedOnDate().isAfter(getActivationLocalDate())) {
-
-            final String defaultUserMessage = "submitted date cannot be after 
the activation date";
-            final ApiParameterError error = 
ApiParameterError.parameterError("error.msg.clients.submittedOnDate.after.activation.date",
-                    defaultUserMessage, 
ClientApiConstants.submittedOnDateParamName, this.submittedOnDate);
-
-            dataValidationErrors.add(error);
+            throw new 
InvalidClientActivationDateException("submittedOnDate.after.activation.date",
+                    "submitted date cannot be after the activation date", 
getSubmittedOnDate());
         }
 
         if (getReopenedDate() != null && getActivationLocalDate() != null && 
getReopenedDate().isAfter(getActivationLocalDate())) {
-
-            final String defaultUserMessage = "reopened date cannot be after 
the submittedon date";
-            final ApiParameterError error = 
ApiParameterError.parameterError("error.msg.clients.submittedOnDate.after.reopened.date",
-                    defaultUserMessage, 
ClientApiConstants.reopenedDateParamName, this.reopenedDate);
-
-            dataValidationErrors.add(error);
+            throw new 
InvalidClientActivationDateException("submittedOnDate.after.reopened.date",
+                    "reopened date cannot be after the submittedon date", 
this.reopenedDate);
         }
 
         if (getActivationLocalDate() != null && 
isDateInTheFuture(getActivationLocalDate())) {
-
-            final String defaultUserMessage = "Activation date cannot be in 
the future.";
-            final ApiParameterError error = 
ApiParameterError.parameterError("error.msg.clients.activationDate.in.the.future",
-                    defaultUserMessage, 
ClientApiConstants.activationDateParamName, getActivationLocalDate());
-
-            dataValidationErrors.add(error);
+            throw new 
InvalidClientActivationDateException("activationDate.in.the.future", 
"Activation date cannot be in the future.",

Review Comment:
   this might break the contract. Priorly the problematic field name was sent, 
i reckon.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to