Modifying DatatabaleEntryRequiredException to extend from AbstractPlatformDomainRuleException
This commit is contained in:
+7
-20
@@ -18,28 +18,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.dataqueries.exception;
|
package org.apache.fineract.infrastructure.dataqueries.exception;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link RuntimeException} thrown when datatable resources are not found.
|
* A {@link AbstractPlatformDomainRuleException} thrown when datatable resources are not found.
|
||||||
*/
|
*/
|
||||||
public class DatatabaleEntryRequiredException extends RuntimeException {
|
public class DatatabaleEntryRequiredException extends AbstractPlatformDomainRuleException{
|
||||||
|
|
||||||
public DatatabaleEntryRequiredException(final String datatableName) {
|
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
|
||||||
|
|
||||||
final String defaultMessage = "The datatable " + datatableName
|
|
||||||
+ " needs to be filled in before the current action can be proceeded";
|
|
||||||
final String messageCode = "error.msg.entry.required.in.datatable." + datatableName;
|
|
||||||
final ApiParameterError error = ApiParameterError.parameterError(messageCode, defaultMessage, "", 1, 0);
|
|
||||||
dataValidationErrors.add(error);
|
|
||||||
|
|
||||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public DatatabaleEntryRequiredException(String datatableName) {
|
||||||
|
super("error.msg.entry.required.in.datatable." + datatableName, "The datatable " + datatableName
|
||||||
|
+ " needs to be filled in before the current action can be proceeded", datatableName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user