diff --git a/java/src/org/openqa/selenium/remote/http/WebSocket.java b/java/src/org/openqa/selenium/remote/http/WebSocket.java index aabfe06d57da6..e49ba03b924fa 100644 --- a/java/src/org/openqa/selenium/remote/http/WebSocket.java +++ b/java/src/org/openqa/selenium/remote/http/WebSocket.java @@ -64,7 +64,11 @@ default void onText(CharSequence data) { } default void onError(Throwable cause) { - LOG.log(WARNING, cause.getMessage(), cause); + String message = cause.getMessage(); + if (message == null && cause.getCause() != null) { + message = cause.getCause().getMessage(); + } + LOG.log(WARNING, message, cause); } } }