Skip to content

Commit

Permalink
Switch to ConnectionFailureException
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed Oct 6, 2016
1 parent cdc79ca commit 614cf13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.neo4j.driver.v1.Value;
import org.neo4j.driver.v1.Values;
import org.neo4j.driver.v1.exceptions.ClientException;
import org.neo4j.driver.v1.exceptions.ConnectionFailureException;
import org.neo4j.driver.v1.types.TypeSystem;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.neo4j.driver.v1.Logger;
import org.neo4j.driver.v1.Transaction;
import org.neo4j.driver.v1.exceptions.ClientException;
import org.neo4j.driver.v1.exceptions.ConnectionFailureException;

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

// Expect
exception.expect( ClientException.class );
exception.expect( ConnectionFailureException.class );

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

// Expect
exception.expect( ClientException.class );
exception.expect( ConnectionFailureException.class );

// When
sess.beginTransaction();
Expand Down

0 comments on commit 614cf13

Please sign in to comment.