Skip to content

Commit 614cf13

Browse files
committed
Switch to ConnectionFailureException
1 parent cdc79ca commit 614cf13

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.neo4j.driver.v1.Value;
3535
import org.neo4j.driver.v1.Values;
3636
import org.neo4j.driver.v1.exceptions.ClientException;
37+
import org.neo4j.driver.v1.exceptions.ConnectionFailureException;
3738
import org.neo4j.driver.v1.types.TypeSystem;
3839

3940
import static org.neo4j.driver.v1.Values.value;
@@ -296,9 +297,9 @@ private void ensureConnectionIsOpen()
296297
{
297298
if ( !connection.isOpen() )
298299
{
299-
throw new ClientException( "The current session cannot be reused as the underlying connection with the " +
300-
"server has been closed due to unrecoverable errors. " +
301-
"Please close this session and retry your statement in another new session." );
300+
throw new ConnectionFailureException( "The current session cannot be reused as the underlying connection with the " +
301+
"server has been closed due to unrecoverable errors. " +
302+
"Please close this session and retry your statement in another new session." );
302303
}
303304
}
304305

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.neo4j.driver.v1.Logger;
2828
import org.neo4j.driver.v1.Transaction;
2929
import org.neo4j.driver.v1.exceptions.ClientException;
30+
import org.neo4j.driver.v1.exceptions.ConnectionFailureException;
3031

3132
import static junit.framework.Assert.fail;
3233
import static junit.framework.TestCase.assertNotNull;
@@ -121,7 +122,7 @@ public void shouldNotAllowMoreStatementsInSessionWhileConnectionClosed() throws
121122
when( mock.isOpen() ).thenReturn( false );
122123

123124
// Expect
124-
exception.expect( ClientException.class );
125+
exception.expect( ConnectionFailureException.class );
125126

126127
// When
127128
sess.run( "whatever" );
@@ -134,7 +135,7 @@ public void shouldNotAllowMoreTransactionsInSessionWhileConnectionClosed() throw
134135
when( mock.isOpen() ).thenReturn( false );
135136

136137
// Expect
137-
exception.expect( ClientException.class );
138+
exception.expect( ConnectionFailureException.class );
138139

139140
// When
140141
sess.beginTransaction();

0 commit comments

Comments
 (0)