[grid] improved exception handling when no cause is set
improved exception handling when no cause is set
In cases where the exception thrown has no cause there was no helpful
stack trace to localize the issue.
@@ -147,8 +147,12 @@ public HttpResponse execute(HttpRequest req) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
- }
+ } else if (cause != null) {
throw new RuntimeException(errorMessage, cause);
+ } else if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ }
+ throw new RuntimeException(errorMessage, e);
}
}
}
