diff --git a/li.strolch.agent/src/main/java/li/strolch/service/api/ServiceResult.java b/li.strolch.agent/src/main/java/li/strolch/service/api/ServiceResult.java index 478b5e221..1f0ff9eba 100644 --- a/li.strolch.agent/src/main/java/li/strolch/service/api/ServiceResult.java +++ b/li.strolch.agent/src/main/java/li/strolch/service/api/ServiceResult.java @@ -22,6 +22,7 @@ import static li.strolch.utils.helper.StringHelper.isEmpty; import java.util.ResourceBundle; import com.google.gson.JsonObject; +import li.strolch.exception.StrolchException; import li.strolch.model.i18n.I18nMessageToJsonVisitor; import li.strolch.utils.I18nMessage; @@ -200,9 +201,12 @@ public class ServiceResult { if (this.throwable != null) { json.addProperty("exceptionMsg", getExceptionMessageWithCauses(this.throwable, false)); json.addProperty("throwable", formatException(this.throwable)); + + if (this.throwable instanceof StrolchException && ((StrolchException) this.throwable).hasI18n()) + json.add("i18n", ((StrolchException) this.throwable).getI18n().accept(new I18nMessageToJsonVisitor())); } - if (this.i18nMessage != null) + if (!json.has("i18n") && this.i18nMessage != null) json.add("i18n", this.i18nMessage.accept(new I18nMessageToJsonVisitor())); return json;