use AbstractPlatformException's defaultUserMessage as RuntimeException's message [FINERACT-1062]
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
bcfbe65d56
commit
9ed9153cba
+1
-1
@@ -167,7 +167,7 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
|||||||
}
|
}
|
||||||
createProvsioningEntry(currentDate, addJournalEntries);
|
createProvsioningEntry(currentDate, addJournalEntries);
|
||||||
} catch (ProvisioningEntryAlreadyCreatedException peace) {
|
} catch (ProvisioningEntryAlreadyCreatedException peace) {
|
||||||
LOG.error("{}", peace.getDefaultUserMessage());
|
LOG.error("Provisioning Entry already created", peace);
|
||||||
} catch (DataIntegrityViolationException dive) {
|
} catch (DataIntegrityViolationException dive) {
|
||||||
LOG.error("Problem occurred in generateLoanLossProvisioningAmount function", dive);
|
LOG.error("Problem occurred in generateLoanLossProvisioningAmount function", dive);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-8
@@ -32,26 +32,27 @@ public abstract class AbstractPlatformException extends RuntimeException {
|
|||||||
private final String defaultUserMessage;
|
private final String defaultUserMessage;
|
||||||
private final Object[] defaultUserMessageArgs;
|
private final Object[] defaultUserMessageArgs;
|
||||||
|
|
||||||
protected AbstractPlatformException(String globalisationMessageCode, String defaultUserMessage, Object[] defaultUserMessageArgs) {
|
|
||||||
super(findThrowableCause(defaultUserMessageArgs));
|
|
||||||
this.globalisationMessageCode = globalisationMessageCode;
|
|
||||||
this.defaultUserMessage = defaultUserMessage;
|
|
||||||
this.defaultUserMessageArgs = AbstractPlatformException.filterThrowableCause(defaultUserMessageArgs);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AbstractPlatformException(String globalisationMessageCode, String defaultUserMessage) {
|
protected AbstractPlatformException(String globalisationMessageCode, String defaultUserMessage) {
|
||||||
|
super(defaultUserMessage);
|
||||||
this.globalisationMessageCode = globalisationMessageCode;
|
this.globalisationMessageCode = globalisationMessageCode;
|
||||||
this.defaultUserMessage = defaultUserMessage;
|
this.defaultUserMessage = defaultUserMessage;
|
||||||
this.defaultUserMessageArgs = NO_ARGS;
|
this.defaultUserMessageArgs = NO_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractPlatformException(String globalisationMessageCode, String defaultUserMessage, Throwable cause) {
|
protected AbstractPlatformException(String globalisationMessageCode, String defaultUserMessage, Throwable cause) {
|
||||||
super(cause);
|
super(defaultUserMessage, cause);
|
||||||
this.globalisationMessageCode = globalisationMessageCode;
|
this.globalisationMessageCode = globalisationMessageCode;
|
||||||
this.defaultUserMessage = defaultUserMessage;
|
this.defaultUserMessage = defaultUserMessage;
|
||||||
this.defaultUserMessageArgs = NO_ARGS;
|
this.defaultUserMessageArgs = NO_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected AbstractPlatformException(String globalisationMessageCode, String defaultUserMessage, Object[] defaultUserMessageArgs) {
|
||||||
|
super(defaultUserMessage, findThrowableCause(defaultUserMessageArgs));
|
||||||
|
this.globalisationMessageCode = globalisationMessageCode;
|
||||||
|
this.defaultUserMessage = defaultUserMessage;
|
||||||
|
this.defaultUserMessageArgs = AbstractPlatformException.filterThrowableCause(defaultUserMessageArgs);
|
||||||
|
}
|
||||||
|
|
||||||
private static Throwable findThrowableCause(Object[] defaultUserMessageArgs) {
|
private static Throwable findThrowableCause(Object[] defaultUserMessageArgs) {
|
||||||
for (Object defaultUserMessageArg : defaultUserMessageArgs) {
|
for (Object defaultUserMessageArg : defaultUserMessageArgs) {
|
||||||
if (defaultUserMessageArg instanceof Throwable) {
|
if (defaultUserMessageArg instanceof Throwable) {
|
||||||
|
|||||||
+2
-2
@@ -26,10 +26,10 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourc
|
|||||||
public class UserNotFoundException extends AbstractPlatformResourceNotFoundException {
|
public class UserNotFoundException extends AbstractPlatformResourceNotFoundException {
|
||||||
|
|
||||||
public UserNotFoundException(final Long id) {
|
public UserNotFoundException(final Long id) {
|
||||||
super("error.msg.user.id.invalid", "User with identifier " + id + " does not exist", id);
|
super("error.msg.user.id.invalid", "User with ID " + id + " does not exist", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserNotFoundException(final String userName) {
|
public UserNotFoundException(final String userName) {
|
||||||
super("error.msg.user.name.not.found", "User with identifier " + userName + " does not exist");
|
super("error.msg.user.name.not.found", "User with name '" + userName + "' does not exist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user