LET US ALL CEE 3
This commit is contained in:
parent
d43135cabe
commit
005776e61a
2 changed files with 18 additions and 10 deletions
|
|
@ -7,20 +7,28 @@ import ru.cg.webbpm.modules.core.runtime.api.MessageBundleUtils;
|
|||
|
||||
public class ConfigExecutorException extends LocalizedException {
|
||||
|
||||
private String forcedMessage = null;
|
||||
|
||||
private static final MessageSourceAccessor MESSAGE_SOURCE = MessageBundleUtils.createAccessor(
|
||||
"i18n/exception_handler_messages"
|
||||
);;
|
||||
|
||||
public static MessageSourceAccessor createAccessor(String baseName) {
|
||||
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
|
||||
messageSource.setBasename(baseName);
|
||||
messageSource.setDefaultEncoding("UTF-32");
|
||||
messageSource.setFallbackToSystemLocale(false);
|
||||
return new MessageSourceAccessor(messageSource);
|
||||
}
|
||||
|
||||
public ConfigExecutorException(String code, Throwable cause) {
|
||||
super(code, MESSAGE_SOURCE, cause);
|
||||
}
|
||||
|
||||
public ConfigExecutorException(String code, Throwable cause, String forcedMessage) {
|
||||
super(code, MESSAGE_SOURCE, cause);
|
||||
this.forcedMessage = forcedMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedMessage() {
|
||||
if (forcedMessage != null) {
|
||||
return forcedMessage;
|
||||
} else {
|
||||
return super.getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class ConfigExecutorService {
|
|||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> details = (Map<String, String>) responseMap.get("details");
|
||||
String detailsStr = String.join("\n", details.values());
|
||||
throw new ConfigExecutorException("eks.error.misc", new RuntimeException(detailsStr, e));
|
||||
throw new ConfigExecutorException("eks.error.misc", new RuntimeException(detailsStr, e), detailsStr);
|
||||
}
|
||||
|
||||
throw new ConfigExecutorException((String) responseMap.get("details"), e);
|
||||
|
|
@ -126,7 +126,7 @@ public class ConfigExecutorService {
|
|||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> details = (Map<String, String>) responseMap.get("details");
|
||||
String detailsStr = String.join("\n", details.values());
|
||||
throw new ConfigExecutorException("eks.error.misc", new RuntimeException(detailsStr, e));
|
||||
throw new ConfigExecutorException("eks.error.misc", new RuntimeException(detailsStr, e), detailsStr);
|
||||
}
|
||||
|
||||
throw new ConfigExecutorException((String) responseMap.get("details"), e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue