use of org.neo4j.graphdb.WriteOperationsNotAllowedException in project neo4j by neo4j.
the class Invocation method executeStatements.
private void executeStatements() {
try {
while (outputError == null) {
memoryPool.reserveHeap(Statement.SHALLOW_SIZE);
try {
Statement statement = readStatement();
if (statement == null) {
return;
}
executeStatement(statement);
} finally {
memoryPool.releaseHeap(Statement.SHALLOW_SIZE);
}
}
} catch (InputFormatException e) {
handleNeo4jError(Status.Request.InvalidFormat, e);
} catch (KernelException | Neo4jException | AuthorizationViolationException | WriteOperationsNotAllowedException e) {
handleNeo4jError(e.status(), e);
} catch (DeadlockDetectedException e) {
handleNeo4jError(Status.Transaction.DeadlockDetected, e);
} catch (Exception e) {
Throwable cause = e.getCause();
if (cause instanceof Status.HasStatus) {
handleNeo4jError(((Status.HasStatus) cause).status(), cause);
} else {
handleNeo4jError(Status.Statement.ExecutionFailed, e);
}
}
}
use of org.neo4j.graphdb.WriteOperationsNotAllowedException in project neo4j-documentation by neo4j.
the class ReadOnlyDocTest method makeSureDbIsOnlyReadable.
@Test
public void makeSureDbIsOnlyReadable() {
// when
try (Transaction tx = graphDb.beginTx()) {
tx.createNode();
tx.commit();
fail("expected exception");
}// then
catch (Exception e) {
assertTrue("Database should be in read only mode", Exceptions.contains(e, c -> c instanceof WriteOperationsNotAllowedException));
// ok
}
}
Aggregations