Skip to content

Commit

Permalink
Improved error messaging for NHA
Browse files Browse the repository at this point in the history
Added another exception type to those than can be raised as a cause of NHA CTR
  • Loading branch information
spmallette committed Jun 19, 2024
1 parent 08dea34 commit a37e93f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
=== TinkerPop 3.6.8 (NOT OFFICIALLY RELEASED YET)
* Fixed bug in Java driver where connection pool was not removing dead connections under certain error conditions.
* Raised handshake exceptions for Java driver for `NoHostAvailableException` situations.
[[release-3-6-7]]
=== TinkerPop 3.6.7 (April 8, 2024)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.driver;

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakeException;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.tinkerpop.gremlin.driver.exception.ConnectionException;
import org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException;
Expand Down Expand Up @@ -555,7 +556,8 @@ protected void initializeImplementation() {
private void throwNoHostAvailableException() {
final Throwable rootCause = ExceptionUtils.getRootCause(initializationFailure);
// allow the certain exceptions to propagate as a cause
if (rootCause instanceof SSLException || rootCause instanceof ConnectException) {
if (rootCause instanceof SSLException || rootCause instanceof ConnectException ||
rootCause instanceof WebSocketClientHandshakeException) {
throw new NoHostAvailableException(initializationFailure);
} else {
throw new NoHostAvailableException();
Expand Down

0 comments on commit a37e93f

Please sign in to comment.