Search in sources :

Example 1 with FabricException

use of org.neo4j.fabric.executor.FabricException in project neo4j by neo4j.

the class TestFabricTransaction method execute.

@Override
public Result execute(String query, Map<String, Object> parameters) throws QueryExecutionException {
    var ctx = new TestFabricTransactionalContext(kernelInternalTransaction);
    var params = ValueUtils.asParameterMapValue(parameters);
    var result = new ResultSubscriber(ctx, ctx.valueMapper());
    try {
        BoltQueryExecution boltQueryExecution = fabricTransaction.executeQuery(query, params, false, result);
        result.init(boltQueryExecution.getQueryExecution());
    } catch (FabricException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        } else {
            throw new QueryExecutionException(e.getMessage(), e, e.status().code().serialize());
        }
    } catch (QueryExecutionKernelException | Neo4jException e) {
        throw new QueryExecutionException(e.getMessage(), e, e.status().code().serialize());
    }
    return result;
}
Also used : BoltQueryExecution(org.neo4j.bolt.dbapi.BoltQueryExecution) QueryExecutionException(org.neo4j.graphdb.QueryExecutionException) QueryExecutionKernelException(org.neo4j.kernel.impl.query.QueryExecutionKernelException) ResultSubscriber(org.neo4j.cypher.internal.javacompat.ResultSubscriber) FabricException(org.neo4j.fabric.executor.FabricException) Neo4jException(org.neo4j.exceptions.Neo4jException)

Aggregations

BoltQueryExecution (org.neo4j.bolt.dbapi.BoltQueryExecution)1 ResultSubscriber (org.neo4j.cypher.internal.javacompat.ResultSubscriber)1 Neo4jException (org.neo4j.exceptions.Neo4jException)1 FabricException (org.neo4j.fabric.executor.FabricException)1 QueryExecutionException (org.neo4j.graphdb.QueryExecutionException)1 QueryExecutionKernelException (org.neo4j.kernel.impl.query.QueryExecutionKernelException)1