Skip to content

Commit e6130bc

Browse files
Catch ClientException while consuming results, too.
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.
1 parent dcae481 commit e6130bc

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

bolt-driver/src/main/java/org/neo4j/ogm/drivers/bolt/request/BoltRequest.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,13 @@ public Response<RowModel> execute(DefaultRequest query) {
101101
for (Statement statement : query.getStatements()) {
102102

103103
Result result = executeRequest(statement);
104+
try (RowModelResponse rowModelResponse = new RowModelResponse(result, entityAdapter)) {
104105

105-
if (columns == null) {
106-
try {
106+
if (columns == null) {
107107
List<String> columnSet = result.keys();
108-
columns = columnSet.toArray(new String[columnSet.size()]);
109-
} catch (ClientException e) {
110-
throw new CypherException(e.code(), e.getMessage(), e);
108+
columns = columnSet.toArray(new String[0]);
111109
}
112-
}
113-
try (RowModelResponse rowModelResponse = new RowModelResponse(result, entityAdapter)) {
110+
114111
RowModel model;
115112
while ((model = rowModelResponse.next()) != null) {
116113
rowModels.add(model);

0 commit comments

Comments
 (0)