Skip to content

Commit

Permalink
Catch ClientException while consuming results, too.
Browse files Browse the repository at this point in the history
This cataches and translations `ClientException` into the generic
Neo4j-OGM `CypherException` while consuming the results too.

It should fix
spring-projects/spring-data-neo4j#2542 and is
most likely necessary to encounter for the changes in
neo4j/neo4j-java-driver#897.
  • Loading branch information
michael-simons committed May 23, 2022
1 parent 149cdba commit 6e0acee
Showing 1 changed file with 6 additions and 7 deletions.
Expand Up @@ -101,21 +101,20 @@ public Response<RowModel> execute(DefaultRequest query) {
for (Statement statement : query.getStatements()) {

Result result = executeRequest(statement);
try (RowModelResponse rowModelResponse = new RowModelResponse(result, entityAdapter)) {

if (columns == null) {
try {
if (columns == null) {
List<String> columnSet = result.keys();
columns = columnSet.toArray(new String[columnSet.size()]);
} catch (ClientException e) {
throw new CypherException(e.code(), e.getMessage(), e);
columns = columnSet.toArray(new String[0]);
}
}
try (RowModelResponse rowModelResponse = new RowModelResponse(result, entityAdapter)) {

RowModel model;
while ((model = rowModelResponse.next()) != null) {
rowModels.add(model);
}
result.consume();
} catch (ClientException e) {
throw new CypherException(e.code(), e.getMessage(), e);
}
}

Expand Down

0 comments on commit 6e0acee

Please sign in to comment.