Skip to content

Commit be32033

Browse files
authored
[grid] improved exception handling when no cause is set (#11286)
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.
1 parent 6ddaaf3 commit be32033

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

java/src/org/openqa/selenium/grid/router/HandleSession.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,12 @@ public HttpResponse execute(HttpRequest req) {
147147
Throwable cause = e.getCause();
148148
if (cause instanceof RuntimeException) {
149149
throw (RuntimeException) cause;
150+
} else if (cause != null) {
151+
throw new RuntimeException(errorMessage, cause);
152+
} else if (e instanceof RuntimeException) {
153+
throw (RuntimeException) e;
150154
}
151-
throw new RuntimeException(errorMessage, cause);
155+
throw new RuntimeException(errorMessage, e);
152156
}
153157
}
154158
}

0 commit comments

Comments
 (0)