ErrorUtil { public static boolean isFatal( Throwable error ) { if ( error instanceof Neo4jException ) { if ( isProtocolViolationError( ((Neo4jException) error) ) ) { return true; } if ( isClientOrTransientError( ((Neo4jException) error) ) ) { return false; } } return true; } private  ErrorUtil(); static ServiceUnavailableException newConnectionTerminatedError( String reason ); static ServiceUnavailableException newConnectionTerminatedError(); static ResultConsumedException newResultConsumedError(); static Neo4jException newNeo4jError( String code, String message ); static boolean isFatal( Throwable error ); static void rethrowAsyncException( ExecutionException e ); static void addSuppressed( Throwable mainError, Throwable error ); static Throwable getRootCause( Throwable error );  }
@Test void shouldTreatNotNeo4jExceptionAsFatal() { assertTrue( isFatal( new IOException( "IO failed!" ) ) ); }
@Test void shouldTreatProtocolErrorAsFatal() { assertTrue( isFatal( new ClientException( "Neo.ClientError.Request.Invalid", "Illegal request" ) ) ); assertTrue( isFatal( new ClientException( "Neo.ClientError.Request.InvalidFormat", "Wrong format" ) ) ); assertTrue( isFatal( new ClientException( "Neo.ClientError.Request.TransactionRequired", "No tx!" ) ) ); }
@Test void shouldTreatAuthenticationExceptionAsNonFatal() { assertFalse( isFatal( new AuthenticationException( "Neo.ClientError.Security.Unauthorized", "" ) ) ); }
@Test void shouldTreatClientExceptionAsNonFatal() { assertFalse( isFatal( new ClientException( "Neo.ClientError.Transaction.ConstraintsChanged", "" ) ) ); }
@Test void shouldTreatDatabaseExceptionAsFatal() { assertTrue( isFatal( new ClientException( "Neo.DatabaseError.Schema.ConstraintCreationFailed", "" ) ) ); }