From 6f8c44d71b36cbfc73832d06e30cf125987c5882 Mon Sep 17 00:00:00 2001 From: Stefan Miklosovic Date: Tue, 3 Nov 2020 17:57:51 +0100 Subject: [PATCH] ignored throwable in Error to break recursivity in go client --- pom.xml | 2 +- .../java/com/instaclustr/operations/Operation.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8cc0f28..f26f1ff 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.instaclustr commons - 1.4.0 + 1.5.0 Instaclustr commons Common classes and utilities integrated with various projects diff --git a/src/main/java/com/instaclustr/operations/Operation.java b/src/main/java/com/instaclustr/operations/Operation.java index 0adc9eb..c147b71 100644 --- a/src/main/java/com/instaclustr/operations/Operation.java +++ b/src/main/java/com/instaclustr/operations/Operation.java @@ -60,6 +60,8 @@ public static class Error { public String source; public String message; + + @JsonIgnore public Throwable throwable; public Error() { @@ -68,7 +70,13 @@ public Error() { public Error(final Throwable throwable, final String message, final String source) { this.throwable = throwable; - this.message = message; + + if (this.throwable != null && this.throwable.getCause() != null && this.throwable.getCause().getMessage() != null) { + this.message = this.throwable.getCause().getMessage(); + } else { + this.message = message; + } + this.source = source; }