Skip to content

Commit ac16172

Browse files
author
Zhen Li
authored
Merge pull request #248 from pontusmelke/1.1-throw-session-expired
Should throw `SessionExpired` instead of `ConnectionFailure`
2 parents 3b90f2c + 14be5b3 commit ac16172

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

driver/src/main/java/org/neo4j/driver/internal/RoutingDriver.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.neo4j.driver.v1.exceptions.ClientException;
3636
import org.neo4j.driver.v1.exceptions.ConnectionFailureException;
3737
import org.neo4j.driver.v1.exceptions.ServiceUnavailableException;
38+
import org.neo4j.driver.v1.exceptions.SessionExpiredException;
3839
import org.neo4j.driver.v1.util.Function;
3940

4041
import static java.lang.String.format;
@@ -292,7 +293,7 @@ private Connection acquireReadConnection()
292293
}
293294
}
294295

295-
throw new ConnectionFailureException( "Failed to connect to any read server" );
296+
throw new SessionExpiredException( "Failed to connect to any read server" );
296297
}
297298

298299
private Connection acquireWriteConnection()
@@ -311,7 +312,7 @@ private Connection acquireWriteConnection()
311312
}
312313
}
313314

314-
throw new ConnectionFailureException( "Failed to connect to any write server" );
315+
throw new SessionExpiredException( "Failed to connect to any write server" );
315316
}
316317

317318
@Override

driver/src/test/java/org/neo4j/driver/internal/RoutingDriverStubTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ public void shouldForgetEndpointsOnFailedSessionAcquisition()
545545
driver.session( AccessMode.READ );
546546
fail();
547547
}
548-
catch ( ConnectionFailureException e )
548+
catch ( SessionExpiredException e )
549549
{
550550
//ignore
551551
}

0 commit comments

Comments
 (0)