[Fix] Always set a message on ServiceResult.toJson()
This commit is contained in:
parent
15a9c924e7
commit
92319d61cd
|
@ -16,6 +16,7 @@
|
||||||
package li.strolch.service.api;
|
package li.strolch.service.api;
|
||||||
|
|
||||||
import static li.strolch.utils.helper.ExceptionHelper.formatException;
|
import static li.strolch.utils.helper.ExceptionHelper.formatException;
|
||||||
|
import static li.strolch.utils.helper.StringHelper.isEmpty;
|
||||||
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
@ -188,7 +189,7 @@ public class ServiceResult {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
|
|
||||||
json.addProperty("state", this.state.name());
|
json.addProperty("state", this.state.name());
|
||||||
json.addProperty("msg", this.message);
|
json.addProperty("msg", isEmpty(this.message) ? "-" : this.message);
|
||||||
|
|
||||||
if (this.throwable != null) {
|
if (this.throwable != null) {
|
||||||
json.addProperty("exceptionMsg", ExceptionHelper.getExceptionMessageWithCauses(this.throwable));
|
json.addProperty("exceptionMsg", ExceptionHelper.getExceptionMessageWithCauses(this.throwable));
|
||||||
|
|
Loading…
Reference in New Issue